Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7585071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:05:03+00:00 2026-05-30T19:05:03+00:00

I’m recently starting to learn Java and have had success writing and compiling my

  • 0

I’m recently starting to learn Java and have had success writing and compiling my own application (written in Sublime Text, a text editor, and compiled via javac).

The application runs perfectly when launched via a terminal (or command prompt if I’m on my Windows PC), but if I try launching it from the file itself (in Windows, double clicking it and ensuring Java is the open-with method, or on my Ubuntu laptop, making it executable and doing the same) I get a very short lived loading cursor and then nothing.

The application (which converts between degrees Celsius and Fahrenheit) uses some simple Swing dialogs to get the user’s input and to display the result.

import javax.swing.*;

public class DegreesConversion
{
public static void main( String [] args)
    {
    String input = JOptionPane.showInputDialog("Enter a temperature followed by either C for Celcius or F for Fahrenheit\nE.g. 30C or 86F");
    int degrees = Integer.parseInt(input.substring(0,input.length()-1));

    switch (input.toLowerCase().contains("f") ? 0 : input.toLowerCase().contains("c") ? 1 : 2){
        case 1:
            JOptionPane.showMessageDialog(null,(((degrees*9)/5)+32)+" degrees Fahrenheit", "Conversion complete", JOptionPane.INFORMATION_MESSAGE);
            break;
        case 0:
            JOptionPane.showMessageDialog(null,(((degrees-32)*5)/9)+" degrees Celcius","Conversion complete",JOptionPane.INFORMATION_MESSAGE);
            break;
        default:
            JOptionPane.showMessageDialog(null, "The input you entered was not recognised!","Unknown input", JOptionPane.ERROR_MESSAGE);
            break;

    }
    }
}

(This is by no means meant to be a serious or terribly functional application, it was simply my own attempt at making something in Java)

Anyhow, I’m not sure why this application, when compiled, only functions when launched from a CLI using “java DegreesConversion”, and not when launched through a double click. I have looked for answers regarding this on Google and Stackoverflow, but haven’t found anything near a relevant solution or hint as to why this is so.

I’m considering that Java .class files can’t be executed the same as .jars?
Any assistance would be greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:05:05+00:00Added an answer on May 30, 2026 at 7:05 pm

    Package your class into a jar file and add a manifest to it pointing to the class having the main method you like to execute.

    Then you can do java -jar jarFile.jar from terminal but it is also possible to easily to run it through, e.g., Windows Open-With capabilities.

    EDIT:
    JAR tutorial

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a reasonable size flat file database of text documents mostly saved in
I have thousands of HTML files to process using Groovy/Java and I need to
I have a bunch of posts stored in text files formatted in yaml/textile (from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.