View Full Version : java programming question
01-14-2003, 01:03 PM
Here is a question, it will be kinda far fetched for most, but i have a feeling that someone in here will know the answer or be able to point me to an appropriate messageboard.
I wrote a chat server in Java for a project i am working on. Our IDE is Netbeans (www.netbeans.org). My chat server is an executable. hOwever, i only know one way to execute it: within netbeans, by pressing F6, it executes the server. I want to find out another way to run it, without using netbeans.
The way that netbeans compiled it , is that all my code goes into chatServer.java. When its compiled, Netbeans creates chatServer.class. That's all i know. There is nothing else in that directory. No executable or anything.
I want a way to make it executabe OUTSIde of netbeans (so an .exe) . Ideally, i'd also like a way to make it run as a windows system service, but that is the second step.
If anyone has any ideas or can point me to a messageboard where people know about this sort of stuff, that would be awesome! thanks
01-14-2003, 01:16 PM
Most likely, you don't actually want to compile it into an exe. An exe is a Windows-specific binary, which means it would only be useful on Windows. Most of the time you don't want to compile Java into a native executable (although it can be done).
One of the big advantages to Java is that it is portable. That class file you have will work on any platform that you have java for (Linux, Sun, HPUX, Windows, Mac, etc...) Generally, you want to leave it as a class (or a jar) file.
I can't go into everything here, so take a look at:
For a lot of good information.
Hope this helps!
01-14-2003, 01:24 PM
Thanks for the hint. Right now i am working under windows, so i do want to make it into an exe.
I could write a makefile and make a Unix executable, i know how to do that because i was trained on unix, but since i work at a government lab, its difficult to get a unix machine to deploy projects on.
01-14-2003, 01:48 PM
Here's a link to one:
I have no experience with native compilers. I think most people using Java leave it in the bytecode (class/jar) form and use the java interpreter (java) to run it. I have no idea what kind of uses you're looking at, but you may want to consider not making an executable at all. I think (I'm not sure, but I think) there are some disadvantages to having an exe file. Anyway, there should be plenty of Java tutorials around to help you out with that stuff, and if not, pick up a book on Java and it should help you out. Let me know if you need anything else
01-14-2003, 02:03 PM
Wow, thank you for the linky.
Maybe my motivation is off. I've been learning java from books, and they dont seem to be giving me the big picture. Here is what i wrote, and what i need now.
My group does contract work for the government, and we are writing a different kind of e-learning software package. So, i had to write a chat server to be integrated in. It is a socket-driven chat server, that creates different chat rooms dynamically based on how many classes are being taught currently with our software. At the end of the day, the chat server takes all the conversation that was had during that day, and archives it to a Knowledge base, on a per class basis. The cool thing about this is so that if the Prof says something important, or answers a critical question in the chat room, it will be archived and searchable for the students when the professor is unavailable.
So, since the archiving happens every night at midnight, the chat server has to run 24/7, with no service interruptions. If they are interrupted, the chat log would be lost. I can modify this to write to text files while the server is still running, but i dont know if i need to, and would add a lot of overhead.
I also want it to run 24/7 because this server is being used by people around the world, on different time zones. I want it to be an individual entity, not depend on our web container (apache tomcat), and be able to log its errors to its own log file.
Right now we open Netbeans, and click Execute. This is undesirable because we have to leave netbeans open on the server all the time. That means that the server console (2k advanced server) is always tied down to one user, and that's not acceptable when we deploy the server.
You seem to know a lot about java, do you know any way that this could be done :))) The executable idea seems like a C++ strategy and not a java strategy.
Thanks so much for the tips.
01-14-2003, 03:38 PM
Tell you what, PM me. I don't think there's too many programmers around here (maybe there are), so people are probably getting sick of reading this stuff. If anyone else would like to keep seeing this stuff posted in this forum speak up!
01-14-2003, 06:35 PM
Thanks. Check your PM :)
I have been searching all afternoon and think i found what i need. A java "servlet". I am still working out the logistics though, i dont know how to set it up yet. Thanks for all the info!
Powered by vBulletin® Version 4.1.12 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.