Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Marius Cherbex
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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.

 
Liutauras Vilda
Marshal
Posts: 4641
318
BSD
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
ok i got it, just needed to update JDK. Thanks for help, now it works : ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!