• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

standalone application question

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to make my application stand alone. It was developed on a linux box with Netbeans 6.9.1, and I have taken the jar file to a Windows 7 laptop and tried to launch the app. I get the following error message: "Could not find the main class: dtvcontrol.DTVControlApp. Program will exit." Laptop has a fresh install of Java 6_24. It will launch from the console of the linux box.

Below is my manifest in the jar file:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.1
Created-By: 1.6.0_20-b20 (Sun Microsystems Inc.)
Main-Class: dtvcontrol.DTVControlApp
Class-Path: lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar lib/be
ansbinding-1.2.1.jar
X-COMMENT: Main-Class will be added automatically by build


Any help is appreciated. Thanks!
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the internal structure of the jar file? In other words, where is that missing class? You can use "jar tf XYZ.jar" to find out.
 
Scott A Burch
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"dist" is the unzipped folder I distributed over to Windows.

scott@richmond:~/extract/dist$ jar tf DTVControl.jar

META-INF/
META-INF/MANIFEST.MF
META-INF/services/
dtvcontrol/
dtvcontrol/resources/
dtvcontrol/resources/busyicons/
META-INF/services/org.jdesktop.application.Application
dtvcontrol/DTVControlApp.class
dtvcontrol/DTVControlView$1.class
dtvcontrol/DTVControlView$10.class
dtvcontrol/DTVControlView$11.class
dtvcontrol/DTVControlView$12.class
dtvcontrol/DTVControlView$13.class
dtvcontrol/DTVControlView$14.class
dtvcontrol/DTVControlView$15.class
dtvcontrol/DTVControlView$16.class
dtvcontrol/DTVControlView$17.class
dtvcontrol/DTVControlView$18.class
dtvcontrol/DTVControlView$19.class
dtvcontrol/DTVControlView$2.class
dtvcontrol/DTVControlView$20.class
dtvcontrol/DTVControlView$21.class
dtvcontrol/DTVControlView$22.class
dtvcontrol/DTVControlView$23.class
dtvcontrol/DTVControlView$24.class
dtvcontrol/DTVControlView$25.class
dtvcontrol/DTVControlView$26.class
dtvcontrol/DTVControlView$27.class
dtvcontrol/DTVControlView$28.class
dtvcontrol/DTVControlView$29.class
dtvcontrol/DTVControlView$3.class
dtvcontrol/DTVControlView$30.class
dtvcontrol/DTVControlView$31.class
dtvcontrol/DTVControlView$32.class
dtvcontrol/DTVControlView$33.class
dtvcontrol/DTVControlView$34.class
dtvcontrol/DTVControlView$35.class
dtvcontrol/DTVControlView$36.class
dtvcontrol/DTVControlView$37.class
dtvcontrol/DTVControlView$38.class
dtvcontrol/DTVControlView$39.class
dtvcontrol/DTVControlView$4.class
dtvcontrol/DTVControlView$40.class
dtvcontrol/DTVControlView$41.class
dtvcontrol/DTVControlView$42.class
dtvcontrol/DTVControlView$5.class
dtvcontrol/DTVControlView$6.class
dtvcontrol/DTVControlView$7.class
dtvcontrol/DTVControlView$8.class
dtvcontrol/DTVControlView$9.class
dtvcontrol/DTVControlView.class
dtvcontrol/resources/AboutBox.properties
dtvcontrol/resources/DTVControlAboutBox.properties
dtvcontrol/resources/DTVControlApp.properties
dtvcontrol/resources/DTVControlView.properties
dtvcontrol/resources/about.png
dtvcontrol/resources/arrow-3D-green-down25.png
dtvcontrol/resources/arrow-3D-green-left25.png
dtvcontrol/resources/arrow-3D-green-right25.png
dtvcontrol/resources/arrow-3D-green-up25.png
dtvcontrol/resources/arrow-3D-green-up40.png
dtvcontrol/resources/busyicons/arrow-3D-green-up40.png
dtvcontrol/resources/busyicons/busy-icon0.png
dtvcontrol/resources/busyicons/busy-icon1.png
dtvcontrol/resources/busyicons/busy-icon10.png
dtvcontrol/resources/busyicons/busy-icon11.png
dtvcontrol/resources/busyicons/busy-icon12.png
dtvcontrol/resources/busyicons/busy-icon13.png
dtvcontrol/resources/busyicons/busy-icon14.png
dtvcontrol/resources/busyicons/busy-icon2.png
dtvcontrol/resources/busyicons/busy-icon3.png
dtvcontrol/resources/busyicons/busy-icon4.png
dtvcontrol/resources/busyicons/busy-icon5.png
dtvcontrol/resources/busyicons/busy-icon6.png
dtvcontrol/resources/busyicons/busy-icon7.png
dtvcontrol/resources/busyicons/busy-icon8.png
dtvcontrol/resources/busyicons/busy-icon9.png
dtvcontrol/resources/busyicons/idle-icon.png
dtvcontrol/resources/nebula.png
dtvcontrol/resources/splash.png
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll quote myself from a similar thread posted in the Beginning Java forum earlier today:

Rob Spoor wrote:Also, try to run your JAR file from the command line first, using "java -jar <jarfile>". When you double click a JAR file it's using the javaw tool which unfortunately shows the same error message (class not found or something like that) for any exception or error that is thrown from the main method. By using the command line you can see those exceptions / errors.

 
Scott A Burch
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried running my application from the Windows 7 console. I get "java is not recognized as an internal or external command, operable program, or batch file" ...

Jar files are associated with Java in the Control Panel. Any ideas?
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you get the "not recognised" error message it usually means a PATH error. Look here, or here, or here (ยง 4).

Are your .jars associated with "javaw.exe" in Control Panel?
 
Scott A Burch
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All the control panel tells me is that .jar is associated with Java Platform SE binary.
 
Scott A Burch
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did the routine of using Browse to find javaw. Then I opened it and presumably it was associated.
 
Campbell Ritchie
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it is associated with "Java Platform" I would assume that is correct until proven otherwise. Did you get your PATH sorted out?
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To me it looks like everything is set up correctly on the Windows box. But when you checked the contents of the jar file, you checked the version on the Linux box, did you not? Whereas the actual problem is with the version on the Windows box. This suggests the possibility that the jar might have been corrupted in the process of transmitting it there. (This could happen if for example you sent it via FTP using ASCII mode.) So check the jar on the Windows box.
 
Scott A Burch
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What app can I use to check it? I use gedit on linux; is there an equivalent on Windows?
 
Scott A Burch
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I checked the details on the box that tells me it can't find the main class and it shows the path to javaw exactly right.
 
Ranch Hand
Posts: 87
Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me assume that, DTVControl.jar is present in your c:\test directory and java version 1.6 is installed on C:\Program Files\Java directory.
In windows , open a command prompt, and execute the following commands.

1) cd c:\test

2) set path=

3) set java_home=

4) set java_home=path to your java installation directory ; For example, set java_home=C:\Program Files\Java\jre6

5) set path=%java_home%\bin

Now just a check if java is available in the path
6) java -version
This should output the the current java version in your windows machine (some thing like "java version "1.6.xxx""). ie; you should not be seeing the "java is not recognized .." message this time if your java_home path is correct.

Now you can try running your application using the command
7)java -jar DTVControl.jar

Regards
Prem
 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

prem pillai wrote:2) set path=

5) set path=%java_home%\bin


Yeah, bad idea. Definitely a bad idea. You loose all system tools from C:\Windows\system32 as well. Better get rid of step 2, and replace step 5 with "set PATH=%JAVA_HOME%\bin;%PATH%". That way you put the JDK's bin folder before the existing path.
 
prem pillai
Ranch Hand
Posts: 87
Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

You loose all system tools from C:\Windows\system32 as well.


This will happen only in the current command window .... !!! Not a big deal ...

I put those steps intensionally to avoid any unwanted paths.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Scott A Burch wrote:What app can I use to check it? I use gedit on linux; is there an equivalent on Windows?


Rename it from x.jar to x.zip and then double-click it.
 
Scott A Burch
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did the above --- skipped step 2 and changed step 5. Console showed me the proper version of Java in the JRE folder. I tried to launch the app using "java -jar DTVControl.jar" and got the same reply " java is not recognized as an internal or external command ..."

Could this be some kind of permission problem? The app iself is executable in the properties window.
 
prem pillai
Ranch Hand
Posts: 87
Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I tried to launch the app using "java -jar DTVControl.jar" and got the same reply " java is not recognized as an internal or external command ..."



Did you do it in the same command window where your have set the java_home & path variable Or in a new command window?

Can you attach a screen shot of the steps you are doing?
 
Scott A Burch
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did it in the same window and it failed. Did it again with a new console window and it also failed. How do I take a screen shot?
 
prem pillai
Ranch Hand
Posts: 87
Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
press print-screen [PrtSc] key in your key board , open a word document Or MS paint , press Cntrl + V.
Then attach it here.
 
Scott A Burch
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did the steps again according to Rob's modification above, and was able to get the "java -version" command to give me the proper response. When I changed the directory to the one that holds my application, it says Java is not recognized.

I have an email into my sysadmin to see if there's a reason why Java won't run.

Thanks for the help.
 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How did you change the directory? From the prompt, using the "cd" command? If so, do you use an absolute path in the JAVA_HOME variable?
 
Scott A Burch
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
cd C:\Program Files(x86)\Java\jre6\bin

I used the absolute path.
 
prem pillai
Ranch Hand
Posts: 87
Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have attached a help file (help.jpg).

1) Save help.jpg file to your machine
2) Rename it to help.bat
3) Open the help.bat in a text editor (notepad). I have added comments in the file to modify some variables. Follow that carefully.
3.a) Replace "D:\test2\test.jar" using the absolute path to your jar file.
3.b) Replace "C:\Program Files\Java\jre6" using the absolute path to your java installation directory.
3.c) Save the file.
4) Open a command window
5) Change directory to the folder where you have saved help.bat
6) Type the command .\help.bat and press enter.

Send me the output of the above command to me .
help.jpg
[Thumbnail for help.jpg]
help file
 
Scott A Burch
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I downloaded a copy of HJSplit for Java onto my Windows 7 laptop and it launched fine when doubleclicking the jar file in the Downloads folder. The only I did differently was to uninstall and reinstall the latest Java using "run as administrator". So it's not the path after all, or a suspect installation of Java, but my coding of my app. Any other suggestions as to what might be wrong?
 
Scott A Burch
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got it to launch on Windows. Somewhere along the way, an external library required for operation was deleted from the distribution. The comment early on was most accurate: the distribution to Windows was corrupted. Once I put it back, the program launched as intended.

Thanks to all for the help and advice.
 
Danger, 10,000 volts, very electic .... tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic