Question

I am opening a .class file using COMSOL multi-physics, and it works fine for one .class file, but I can't open several .class files at a time. My problem is that I want to be able to build more complicated objects inside the class that I open but, when I import these classes and build the project, I end up with multiple .class files. When I open the main .class file in COMSOL, a "error running java class", which I assume is because I've only opened one class.

I am not very familiar with programming in Java, but I started trying to put my classes inside one file, but when I build there still 3 output .class files. Also, in case it matters, I am running on a windows 7 machine and using Eclipse... I would greatly appreciate any suggestions.

Was it helpful?

Solution

You need a .class for each class. The usual solution is to combine them into a .jar. The .jar file can be downloaded and moved around as a single file, regardless of how many classes it represents. You can mark it to identify the main class, so it can be run much as a single class file.

Creating a .jar is one of the options in Eclipse for File-Export

OTHER TIPS

No, You should create a new .class file for every class you want to have.

If a source file has more than one class, each class is compiled into a separate class file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top