running source code in eclipse

This topic has been viewed 4370 times and has 9 replies
Thread status: Active
Questions about extending features and developing plug-ins [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
buzzz
Posts: 54
Joined: Sun Jun 25, 2017 9:02 am
Country: FR

running source code in eclipse

Post by buzzz »

Hi all

I try to run SW Java source code in Eclipse.
I use Java 15 and eclipse 2021.

I select as main class :
com.eteks.sweethome3d.SweetHome3DBootstrap

I have strange errors :



WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by javax.media.j3d.JoglPipeline

Can't load library: C:\Users\toto\Desktop\SweetHome3D-7.1-src\natives\windows-amd64\gluegen_rt.dll


Strangely, building the jar with ant works well and jar run fine
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: running source code in eclipse

Post by Puybaret »

Did you follow the instructions in the README.TXT file of SweetHome3D project?
Emmanuel Puybaret, Sweet Home 3D creator
buzzz
Posts: 54
Joined: Sun Jun 25, 2017 9:02 am
Country: FR

Re: running source code in eclipse

Post by buzzz »

Oups... yes, I forget to add the VM arguments, it now works.

I still have an error with the substring call here :

Code: Select all

if (yafarayPluginsFolder != null) 
{
  try 
  {
     String jarFile = sweetHome3DBootstrapClass.getResource(sweetHome3DBootstrapClass.getSimpleName() + ".class").getFile();
     String t = jarFile.substring(0, jarFile.indexOf("!/"));
     URL applicationJarUrl = new URL(t);
with :
jarfile = C:/Users/toto/Desktop/SweetHome3D-7.1-src/classes/com/eteks/sweethome3d/SweetHome3DBootstrap.class
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: running source code in eclipse

Post by Puybaret »

Select [font=courier new]com.eteks.sweethome3d.SweetHome3D[/font] as main class.
[font=courier new]com.eteks.sweethome3d.SweetHome3DBootstrap[/font] is made to be run from a JAR executable or Applet / Java Web Start environment.
Emmanuel Puybaret, Sweet Home 3D creator
buzzz
Posts: 54
Joined: Sun Jun 25, 2017 9:02 am
Country: FR

Re: running source code in eclipse

Post by buzzz »

thank you very much
buzzz
Posts: 54
Joined: Sun Jun 25, 2017 9:02 am
Country: FR

Re: running source code in eclipse

Post by buzzz »

Hi
I have some problems with openJDK15, GUI is not refreshing correctly, some buttons are placed incorrectly, windows screen update is done partially.

So I suppose, I will install the last version of the JDK to run the app. Nevertheless, I need to compile with an older version. Which jre version do you recommend to run SW 7.1 in eclipse ?
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: running source code in eclipse

Post by Puybaret »

I mainly use Eclipse under macOS so I'm not sure my advice will interest you. Anyway the best advice is to follow Eclipse recommandations.
It's also possible to install more than a JDK in your system and use them in Eclipse. At this moment, I have 5 different JDKs/JREs configured in my Eclipse installation.
Emmanuel Puybaret, Sweet Home 3D creator
buzzz
Posts: 54
Joined: Sun Jun 25, 2017 9:02 am
Country: FR

Re: running source code in eclipse

Post by buzzz »

Thks

I notice that I have no problem when running the jar with openjdk15

So I install Eclipse last version and everything works fine.
AvinashC
Posts: 6
Joined: Wed Apr 03, 2024 9:53 am
Country: India

Re: running source code in eclipse

Post by AvinashC »

Hi all,
I am trying to run the code from the git repo: https://github.com/SweetHome3D/SweetHome3D

I am currently using the latest version Eclipse and jdk

i am running the code with com.eteks.sweethome3d.SweetHome3DBootstrap as the main class with the arguments
-classpath lib/java3d-1.6:<other_directories_or_jars>
-Djava.library.path=lib/java3d-1.6/macosx
-Djogamp.gluegen.UseTempJarCache=false
as i am using mac

i am getting the following errors
2024-04-03 14:26:14.327 java[1597:45750] WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GLCapabilitiesChooser
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at javax.media.j3d.Pipeline$1.run(Pipeline.java:162)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:157)
at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:965)
at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:299)
at javax.media.j3d.GraphicsConfigTemplate3D.isGraphicsConfigSupported(GraphicsConfigTemplate3D.java:351)
at com.eteks.sweethome3d.j3d.Component3DManager.createGraphicsConfigurationTemplate3D(Component3DManager.java:112)
at com.eteks.sweethome3d.j3d.Component3DManager.<init>(Component3DManager.java:83)
at com.eteks.sweethome3d.j3d.Component3DManager.getInstance(Component3DManager.java:160)
at com.eteks.sweethome3d.SweetHome3D.addComponent3DRenderingErrorObserver(SweetHome3D.java:642)
at com.eteks.sweethome3d.SweetHome3D.init(SweetHome3D.java:467)
at com.eteks.sweethome3d.SweetHome3D.main(SweetHome3D.java:370)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLCapabilitiesChooser
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
... 14 more

Could you please help with this
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: running source code in eclipse

Post by Puybaret »

This repository is not official and apparently not maintained. Use the repository at SourceForge.net or a source code archive, and be sure to read the README.TXT included file.
Emmanuel Puybaret, Sweet Home 3D creator
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 1 guest