wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes No Display when running the jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "No Display when running the jar" Watch "No Display when running the jar" New topic
Author

No Display when running the jar

Kevin Florish
Ranch Hand

Joined: Jan 06, 2009
Posts: 163
Hi fellow ranchers

I created my runme.jar for some final testing and have hit a snag as the error messages and my log messages are not being displayed when I run this. My log file is set up as follows:




Everything works fine in Eclipse.

So for example running "runme.jar a" in Dos just exits the application with no messages.

If I run this in Eclipse I get:



Has anyone else encountered this problem. I am using java 1.6.0_12

Thanks Kevin

Java5 Tutorials | Java6 Tutorials | HTML/CSS Tutorials | JavaScript and jQuery Tutorials
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 1963
    
    7

Hi Kevin, I don't personally use Eclipse but Netbeans, but the idea is the same. Does Eclipse use any internal classpath you are not aware of? How does Eclipse build the application?

If you don't use Eclipse to build the app, but use command prompt, do you get the same result when running the app?


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7
Kevin Florish
Ranch Hand

Joined: Jan 06, 2009
Posts: 163
The build that I use in Eclipe works fine.

My manual build is the problem.

I created the classes in Dos using javac then created the jar in Dos as well.

My path points to the 1.6.0_12 jdk and I have used a version checker to make sure I am getting a 1.6 compile.

Everything else works fine in my manual build, just not displaying log info meassages and System.err.println() in the Dos window.
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 1963
    
    7

Did you include a manifest file when "manually" creating your runme.jar specifying the main class and remember the extra line at the end?

If you use Windows OS you may want to use batch files to compile and create the jar.

My file structure looks like this in the root:
docs dir - documentation files go here
code dir - source files go here
classes dir - compiled class files go here
version.txt
database file
runme.jar
manifest.txt
whole bunch of batch file xxx.bat

Then my build.bat file looks like this
javac -d classes code/<full-package-name>/*.java
jar cvfm runme.jar manifest.txt -C classes .

Then my run file looks like this where "alone" is the mode flag:
java -jar runme.jar alone


If all goes wrong, check your app entry point main method.
Kevin Florish
Ranch Hand

Joined: Jan 06, 2009
Posts: 163
Hi Ken

I have no problem compiling the classes and the jar file works fine (yes I have a Manifest.mf file for this).

I do the following from the code subdirectory:

then after I move up to my main directory I do:


My problem isnt getting a working jar its the fact that I am not getting system messages and log messages in Dos window. Everything else I test seems to work (gui display, booking etc) its just these missing log messages and system error messages that have me stuck at the moment.

Cheers Kevin.

Alex Belisle Turcot
Ranch Hand

Joined: Apr 26, 2005
Posts: 516
Hi,

is it be possible that you are using "javaw.exe" to launch your jar (rather than java.exe) ? How do you launch your jar ? Manually with the "java -jar.." command or do you double click on it ?
You could check to which executable .jar extention is linked on your OS.

bye,
Alex
Kevin Florish
Ranch Hand

Joined: Jan 06, 2009
Posts: 163
Hi Alex.

Thanks for that post, I had become blinkered there and was just running runme.jar

Now doing java -jar runme.jar a

And all messages are appearing as they should
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: No Display when running the jar
 
Similar Threads
Should this situation happen?
in the final countdown
server/alone command line
Deadlock testing class for B&S 2.2.1
URLyBird: runme.jar