• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

creating an exe file from jar, but cannot run it normally

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, i am new at Java, and recently faced a problem:
This code is used to count how many times a method is called and store a variable in a txt file, which is updated everytime a program is run.
I have exported it to .jar file using eclipse, made an .exe using Launch4j. But when I click the .exe file nothing happens, the txt file doesn't appear, but when i run it in eclipse - everything is ok. Any solutions?

Pasted the code below:



Maybe the problem is not in the code, and im just simply stupid at making it as an .exe? Thank you.

 
Sheriff
Posts: 8534
615
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Marius Ne tau zinot wrote:I have exported it to .jar file using eclipse, made an .exe using Launch4j.


Welcome to the Ranch.

Assuming your code is correct, why do you need to convert it to .exe, you can export your app as a .jar runnable file. Try and see if it works in same way as it works in eclipse.
File > Export > Java > Runnable JAR File.
 
Marius Cherbex
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Liutauras Vilda wrote:

Marius Ne tau zinot wrote:I have exported it to .jar file using eclipse, made an .exe using Launch4j.


Welcome to the Ranch.

Assuming your code is correct, why do you need to convert it to .exe, you can export your app as a .jar runnable file. Try and see if it works in same way as it works in eclipse.
File > Export > Java > Runnable JAR File.



In this way, it gives me an error when i double click the runable .jar file:

A Java Exception has occured
 
Marius Cherbex
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok i got it, just needed to update JDK. Thanks for help, now it works : ]
 
Forget Steve. Look at this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic