Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Eclipse Export(How to Export a program)
Eclipse Export [message #774016] Tue, 03 January 2012 00:02 Go to next message
Tobias Lelle is currently offline Tobias Lelle
Messages: 38
Registered: February 2013
Member
I want to export this program as a single runnable file to email to a friend. How would you go about doing this?

Code:

import java.util.Scanner;


public class Addition {

public static void main(String[] args) {
System.out.println("Welcome To The Addition Calculator");
System.out.println("Please Type The First Number:");
Scanner scan = new Scanner(System.in);
double num1 = scan.nextDouble();
System.out.println("Please Type The Second Number:");
double num2 = scan.nextDouble();
double num3 = num1 + num2; //you could use int instead of double
System.out.println("The Anwser Is: " + num3);
}

}
Re: Eclipse Export [message #774527 is a reply to message #774016] Wed, 04 January 2012 00:03 Go to previous messageGo to next message
Nick Clevery is currently offline Nick Clevery
Messages: 50
Registered: January 2012
Member
Select File -> Export. In the Export dialog select Java -> JAR file, then you need to specify the JAR file name and main class.
Re: Eclipse Export [message #775460 is a reply to message #774527] Thu, 05 January 2012 21:48 Go to previous messageGo to next message
zach kalb is currently offline zach kalb
Messages: 5
Registered: January 2012
Junior Member
I did that and even tried the runnable jar file and when i double clicked it, it wouldn't do anything. I know if you have the java jdk installed then you can go into command prompt, goto the directory of the .jar file and type "java (tthen the name of the file w/o .jar)" but I just want it to be double clicked. any other way?

Thanks, Zach
Re: Eclipse Export [message #775500 is a reply to message #775460] Fri, 06 January 2012 00:48 Go to previous messageGo to next message
Nick Clevery is currently offline Nick Clevery
Messages: 50
Registered: January 2012
Member
So the problem is the association of file type JAR in your OS. The *.jar file does not associate to Java launcher, check file type association on your computer.
Re: Eclipse Export [message #776523 is a reply to message #775500] Sun, 08 January 2012 12:13 Go to previous message
zach kalb is currently offline zach kalb
Messages: 5
Registered: January 2012
Junior Member
when i code a gui program and export it as a jar file it runs fine but when it's a program the runs in the command prompt it wont work but i know you can make a batch file in the same folder as the class (or the .java file i forget witch one it is) file and type: java "the name of the file" it will run but you half to have the java development kit installed. is there any way to run it w/o the java dev kit installed?

Thanks,
Zach
Previous Topic:Disable cookies in internal browser
Next Topic:Eclipse not showing properties popups for android on Mac OS Lion
Goto Forum:
  


Current Time: Thu Jul 31 05:33:53 EDT 2014

Powered by FUDForum. Page generated in 0.01816 seconds