Results 1 to 3 of 3
  1. #1
    JonnySnip3r is offline Member
    Join Date
    Jan 2010
    Rep Power

    Default Exporting to JAR and running in cmd

    Hey guys i have just created a program in eclipse to calculate UCAS points as i am going to uni this year and had nothing else to do today haha :)

    Anyways one things i have never learned to do in java (btw i am a noob only been learning for a few weeks) is export as JAR and be able to run it in command prompt.

    I can get the thing to run in cmd if i compile it using command prompt or in eclipse when i debug it everything works fine however when i run the finished JAR file on windows nothing happens :( do i need to import something or am i doing it wrong?

    here is the source for my application.

    Java Code:
    import java.util.Scanner;
    public class ucasCalc {
    	public static void main(String[] args) throws IOException{
    		int totalUCAS = 0;
    		char grade;
    		int counter = 0;
    		int howMany; // Stores the amount of grades.
    		char CharP = 6;
    		char CharM = 12;
    		char CharD = 18;
    		System.out.print("Please enter how many grades you need me to calculate: ");
    		Scanner input = new Scanner(;
    		howMany = input.nextInt();
    		System.out.println("I will now calculate " + howMany);
    		System.out.println("D = 18, M = 12, P = 6");
    		while (counter < howMany) {
    			System.out.print("Please enter grade (eg D,M,P): ");
    			grade =;
    			if (grade == 'D') {
    				totalUCAS = totalUCAS + CharD;
    			if (grade == 'M'){
    				totalUCAS = totalUCAS + CharM;
    			if (grade == 'P'){
    				totalUCAS = totalUCAS + CharP;
    		System.out.println("Your overall UCAS points are: " + totalUCAS);
    		File someFile = new File("UCAS_POINTS.txt");
    		BufferedWriter output = new BufferedWriter(new FileWriter(someFile));
    		output.write("Program created by John :) You have " + totalUCAS + " points.");
    if there is something that i have done that could have been done more efficiently then not my fault im a noob haha :)

    Thanks in advance.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power


    I see a bunch of Sytem.out.println( ... ) calls so you can't use javaw.exe for it because that version of the jvm doesn't fire up a console for you. What are you using for your command line?

    kind regards,


  3. #3
    JonnySnip3r is offline Member
    Join Date
    Jan 2010
    Rep Power


    Hey dude im using command prompt in windows. is there any other way you suggest?

    Thanks :)

Similar Threads

  1. Exporting jar problem
    By cocorota in forum Eclipse
    Replies: 0
    Last Post: 11-20-2009, 06:08 PM
  2. Replies: 0
    Last Post: 08-26-2009, 02:03 PM
  3. Problem when exporting to CSV
    By deepusrp in forum New To Java
    Replies: 10
    Last Post: 06-26-2009, 10:33 AM
  4. Exporting Question
    By Moncleared in forum Eclipse
    Replies: 9
    Last Post: 03-08-2009, 08:35 AM
  5. Exporting my project
    By Nim in forum CLDC and MIDP
    Replies: 3
    Last Post: 11-04-2008, 12:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts