Unable to open class - java

Provided is what my Netbeans program looks like right now, I've been trying to google this for hours but have found nothing that has helped. For an assignment I am supposed to open the 'Dealership.class' class and modify it, when I do the following nothing happens;
Double clicking the .class file
file > open file > dealership.class
dragging dealership.class into the editor window
When I double click the file I get an error from Netbeans saying "Cannot open, no source".
Can anyone tell me why this is occurring?
What my Netbeans looks like via Gyazo

Don't open the class file, open
Dealership.java
Instead, that is the uncompiled text version that is readable

If you don't have dealership.java,
There is No way when using normal IDEs.
Use JD to decompile the file to a .java and open it.

Related

Error while creating a jar file with BlueJ

I was trying to create a jar file with Bluej and for some reason BlueJ would not let me include libraries that I was using (Specifically the Amazon SDK for Java)
It gave off an error "jar file could not be written correctly, check for access rights" or something along the lines of that. Is this just a BlueJ problem or is there something I need to do before creating a jar file that needs to include third party libraries?
Thanks.
I believe the answer to your question can be found here, at the BlueJ FAQ website:
https://www.bluej.org/faq.html#faq_How_do_I_use_custom_class_libraries__JARs__
The website describes three ways of doing this in BlueJ. The first way is via the "Preferences" dialog. Open the "Preferences" dialogue and select the "Libraries" tab. Then add the location where your classes are as a library path. Restart BlueJ - done. The selected libraries will now be available in all projects that you open.

Using a JavaFX application as standard program for mp3 files

I'm working on a media player using JavaFX right now and I would like to set it as the standard program to open .mp3 files in the future.
I know how to change the standard program. But when the user double clicks a specific file and my program opens up how would I be able to get the path to the file the user clicked on?
Thanks in advance!
This is the way I made it work:
I exported my program from Eclipse. Then I opened an mp3 file using the program but I got an error message saying something like this: "Invalid Win-32 application".
Having used Launch4j before, I tried wrapping my file in an exe file, which made it work perfectly.
I don't know if you are able to set a jar file as a standard program in other OSs, but you can't in Windows, unfortunately. But at least the OS gives you the path to the file the user clicked on!
Thanks again to #James_D !

opening of eclipse files written to java

I want to open a file in eclipse but I get this error
my friends i want to open the eclipse file that i write from befroe on other pc but it does not open and tell me this error;
It looks like you are trying to open a .class file which is not in the current workspace. The class file editor does not support this and gives this error when you do this.
Note: The class file editor does not attempt to convert the contents to Java, it just shows you the Java bytecode.
I guess the file is visible in eclipse but it is impossible for you to open it. Try to Project -> clean workspace.

Mac OS El Capitan never opens .jar files

Every time I try to save a.jar file for my programming course and it doesn't open, and yes I save the META.MF whit the correct path, I even stop making them on the Terminal and use Net Beans but same problem Error: Could not find or load main class a3t8e1.A3T8e1 maybe I need to download something else.
I search on the internet and download the jar launcher but nothing better.
this is the .jar unpacked
Please try to right click the .jar file and click the Get Info. Under the Open with, select the Jar Launcher.app. After that, try to reopen your related .jar file.

When trying to open a .java file from windows explorer I get a "No project found to open file in" error message

So, when I double click a file in windows explorer, Intellij fires up, but instead of just showing me the file I want to see, shows up the following message:
I think I get what it means: it means this given .java file isn't associated with an Intellij project.
That's actually true, but even so I'd like to be able to open the file and see it with syntax highlighting and such.
How to overcome this problem?
Thanks
It's a known limitation which we plan to address in the future versions to allow opening and editing individual files without project context.
Please watch/vote the related issue.
I don't think you can'tcan by default. I'm assuming you are opening downloaded files or such. What I would is create a project (Scrapbook for example is a good name) on desktop and I would put/download the file I want to see in the corresponding src folder. That way when I'm clicking it would open properly.
Most of the syntax highlight and such goodness of idea comes from a proper project setup (proper JDK paths, libraries, etc).

Categories

Resources