Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Java 3d view Plug-in
Java 3d view Plug-in [message #788070] Wed, 01 February 2012 10:11 Go to next message
Federico Pozzoni is currently offline Federico PozzoniFriend
Messages: 16
Registered: December 2011
Junior Member
Hi,
I'm trying to create a new eclipse view with a java 3d viewer.
When i try to launch the new eclipse application i get an error,

Quote:

Error
Wed Feb 01 11:04:22 CET 2012
Unable to create view ID org.eclipse.j3d.view.ColladaView: javax/media/j3d/Bounds

java.lang.ClassNotFoundException: javax.media.j3d.Bounds
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:489)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.j3d.view.ColladaView.createPartControl(ColladaView.java:27)
at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:367)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:226)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:529)
at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256)
at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:668)
at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:576)
at org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:568)
at org.eclipse.ui.internal.PerspectiveHelper.activate(PerspectiveHelper.java:272)
at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:981)
at org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:2626)
at org.eclipse.ui.internal.WorkbenchWindow$27.run(WorkbenchWindow.java:2964)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:2945)
at org.eclipse.ui.internal.WorkbenchWindow$21.runWithException(WorkbenchWindow.java:2262)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
at org.eclipse.ui.internal.Workbench$28.runWithException(Workbench.java:1384)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2316)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)



I think that eclipse are unable to see the external .jar that my View.java (that lounched alone work fine) requires.

my plugin.xml
Quote:

<plugin
name="Java3d Views Plugin"
id="org.eclipse.J3d.view"
version="1.0.0"
provider-name="OTI">

<requires>
<import plugin="org.eclipse.core.boot"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.swt"/>
<import plugin="org.eclipse.ui"/>
</requires>

<extension point="org.eclipse.ui.views">
<view id="org.eclipse.j3d.view.ColladaView"
name="ColladaView"
class="org.eclipse.j3d.view.ColladaView"
icon="icons\view.gif"/>
</extension>
</plugin>




My colladaview.java


Quote:

package org.eclipse.j3d.view;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
import org.jdesktop.j3d.loaders.collada.Collada14Loader;
import org.jdesktop.j3d.loaders.collada.xml_walker.*;
import com.sun.j3d.loaders.Loader;
import com.sun.j3d.loaders.Scene;
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.universe.SimpleUniverse;
import com.sun.j3d.utils.behaviors.vp.OrbitBehavior;


public class ColladaView extends ViewPart
{
public String filename= "macchina.dae";
public View collada;

public ColladaView() {
System.out.println("costruttore");
}
@Override
public void createPartControl(Composite arg0) {
try {
System.out.println("create oart control");
collada=new View(this.filename);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void setFocus() {
collada.setFocusable(true);
collada.requestFocus();

}
@Override
public void dispose() {
super.dispose();
}
}


my view.java

Quote:

package org.eclipse.j3d.view;

import java.applet.Applet;
import java.awt.*;
import java.net.URL;

import javax.media.j3d.*;
import javax.vecmath.*;

import org.jdesktop.j3d.loaders.collada.Collada14Loader;
import org.jdesktop.j3d.loaders.collada.xml_walker.*;

import com.sun.j3d.loaders.Loader;
import com.sun.j3d.loaders.Scene;
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.universe.SimpleUniverse;
import com.sun.j3d.utils.behaviors.vp.OrbitBehavior;


public class View extends Applet
{
String filename;
//java.net.URL url;
URL url;

public View(final String model)throws Exception
{
this.filename = model;
//this.filename = "macchina.dae";

System.out.println("costruttore view");

setLayout(new BorderLayout());
Canvas3D canvas = createCanvas();
add("Center", canvas);
SimpleUniverse u = new SimpleUniverse(canvas);

BranchGroup scene = createContent();

OrbitBehavior orbit = new OrbitBehavior(canvas);
orbit.setSchedulingBounds(new BoundingSphere(new Point3d(10.0, 10.0, 0.0), 10.0));
u.getViewingPlatform().setViewPlatformBehavior(orbit);

TransformGroup vtg = u.getViewingPlatform().getViewPlatformTransform();
Transform3D moveback = new Transform3D();
moveback.setTranslation(new Vector3f(0.0f, 0.0f, 10.0f));
vtg.setTransform(moveback);

scene.compile();
u.getViewer().getView().setBackClipDistance(100.0);
u.addBranchGraph(scene);
}

private Canvas3D createCanvas()
{
GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
GraphicsConfiguration gc1 = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(template);
return new Canvas3D(gc1);
}

private BranchGroup createContent()
throws Exception
{
System.out.println("loader");
Loader loader = new Collada14Loader();
//Loader loader = new MS3DLoader();
//Loader loader = new KmzLoader();

// Use these 4 lines to load from a local file
java.io.File file = new java.io.File(filename);
System.out.println(file.getParent() + java.io.File.separator);
if (file.getParent() != null)
if (file.getParent().length() > 0) // figure out the base path
loader.setBasePath(file.getParent() + java.io.File.separator);
System.out.println(file.getName());
Scene scene = loader.load(file.getName());
BranchGroup group = scene.getSceneGroup();
createLights(group);
return group;


}

private void createLights(BranchGroup graphRoot)
{
// Create a bounds for the light source influence
BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);

// Set up the global, ambient light
Color3f alColor = new Color3f(1.0f, 1.0f, 1.0f);
AmbientLight aLgt = new AmbientLight(alColor);
aLgt.setInfluencingBounds(bounds);
graphRoot.addChild(aLgt);

// Set up the point (infinite) light source
Point3f location = new Point3f(0.0f, 0.0f, 100.0f);
PointLight lgt1 = new PointLight(new Color3f(1.0f, 1.0f, 1.0f),
location,
new Point3f(1.0f, 0.0f, 0.0f));
lgt1.setInfluencingBounds(bounds);
graphRoot.addChild(lgt1);

// create an Appearance and Material
Appearance app = new Appearance( );
Color3f objColor = new Color3f( 1.0f, 0.7f, 0.8f );
Color3f black = new Color3f( 0.0f, 0.0f, 0.0f );
app.setMaterial( new Material( objColor, black, objColor, black, 80.0f ) );

Sphere sphere = new Sphere(1.0f, Sphere.GENERATE_NORMALS, app);
// a sphere to represent the light source.
Transform3D trans = new Transform3D();
trans.setTranslation(new Vector3f(location));
TransformGroup tg = new TransformGroup();
tg.setTransform(trans);
tg.addChild(sphere);
graphRoot.addChild(tg);

}

}

[Updated on: Wed, 01 February 2012 10:18]

Report message to a moderator

Re: Java 3d view Plug-in [message #788090 is a reply to message #788070] Wed, 01 February 2012 10:43 Go to previous messageGo to next message
Federico Pozzoni is currently offline Federico PozzoniFriend
Messages: 16
Registered: December 2011
Junior Member
Another Error
Quote:

eclipse.buildId=unknown
java.version=1.7.0_01
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=it_IT
Framework arguments: -product org.eclipse.amalgam.dsltk.product
Command-line arguments: -product org.eclipse.amalgam.dsltk.product -data C:\Documents and Settings\Federico\Desktop\dsltk\workspace\NEWVIEW2/../runtime-New_configuration -dev file:C:/Documents and Settings/Federico/Desktop/dsltk/workspace/NEWVIEW2/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties -os win32 -ws win32 -arch x86


Error
Wed Feb 01 11:41:57 CET 2012
Unable to create view ID org.eclipse.j3d.view.ColladaView: com/sun/j3d/loaders/Loader

java.lang.ClassNotFoundException: com.sun.j3d.loaders.Loader
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:489)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.j3d.view.ColladaView.createPartControl(ColladaView.java:27)
at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:367)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:226)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:529)
at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256)
at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:668)
at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:576)
at org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:568)
at org.eclipse.ui.internal.PerspectiveHelper.activate(PerspectiveHelper.java:272)
at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:981)
at org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:2626)
at org.eclipse.ui.internal.WorkbenchWindow$27.run(WorkbenchWindow.java:2964)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:2945)
at org.eclipse.ui.internal.WorkbenchWindow$21.runWithException(WorkbenchWindow.java:2262)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
at org.eclipse.ui.internal.Workbench$28.runWithException(Workbench.java:1384)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2316)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)


Re: Java 3d view Plug-in [message #788103 is a reply to message #788070] Wed, 01 February 2012 10:52 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
This looks like the pre 3.0 plugin way (older than 7 years!!!!)! You
should switch to OSGi-Usage!

Next problem is that you are using Swing and to embed this into SWT you
need to do extra steps using the SWT-Awt-Bridge.

Might I also suggest that you take a look at JavaFX 2.0 if you want to
3d stuff in Java?

I'd suggest you start with one of the many only tutorials on writing a

Tom

Am 01.02.12 11:11, schrieb Federico Pozzoni:
> Hi,
> I'm trying to create a new eclipse view with a java 3d viewer.
> When i try to launch the new eclipse application i get an error,
> I think that eclipse are unable to see the external .jar that my
> View.java (that lounched alone work fine) requires.
>
> my plugin.xml
> Quote:
>> <plugin
>> name="Java3d Views Plugin"
>> id="org.eclipse.J3d.view"
>> version="1.0.0"
>> provider-name="OTI">
>> <requires>
>> <import plugin="org.eclipse.core.boot"/>
>> <import plugin="org.eclipse.core.runtime"/>
>> <import plugin="org.eclipse.core.resources"/>
>> <import plugin="org.eclipse.swt"/>
>> <import plugin="org.eclipse.ui"/>
>> </requires>
>>
>> <extension point="org.eclipse.ui.views">
>> <view id="org.eclipse.j3d.view.ColladaView"
>> name="ColladaView"
>> class="org.eclipse.j3d.view.ColladaView"
>> icon="icons\view.gif"/>
>> </extension>
>> </plugin>
>
>
>
> My colladaview.java
>
>
> Quote:
>> package org.eclipse.j3d.view;
>>
>> import org.eclipse.swt.widgets.Composite;
>> import org.eclipse.ui.part.ViewPart;
>> import org.jdesktop.j3d.loaders.collada.Collada14Loader;
>> import org.jdesktop.j3d.loaders.collada.xml_walker.*;
>> import com.sun.j3d.loaders.Loader;
>> import com.sun.j3d.loaders.Scene;
>> import com.sun.j3d.utils.geometry.*;
>> import com.sun.j3d.utils.applet.MainFrame;
>> import com.sun.j3d.utils.universe.SimpleUniverse;
>> import com.sun.j3d.utils.behaviors.vp.OrbitBehavior;
>>
>>
>> public class ColladaView extends ViewPart
>> {
>> public String filename= "macchina.dae";
>> public View collada;
>> public ColladaView() {
>> System.out.println("costruttore");
>> }
>> @Override
>> public void createPartControl(Composite arg0) {
>> try {
>> System.out.println("create oart control");
>> collada=new View(this.filename);
>> } catch (Exception e) {
>> e.printStackTrace();
>> }
>> }
>> @Override
>> public void setFocus() {
>> collada.setFocusable(true);
>> collada.requestFocus();
>>
>> } @Override
>> public void dispose() {
>> super.dispose();
>> }
>> }
>
>
> my view.java
>
> Quote:
>> package org.eclipse.j3d.view;
>>
>> import java.applet.Applet;
>> import java.awt.*;
>> import java.net.URL;
>>
>> import javax.media.j3d.*;
>> import javax.vecmath.*;
>>
>> import org.jdesktop.j3d.loaders.collada.Collada14Loader;
>> import org.jdesktop.j3d.loaders.collada.xml_walker.*;
>>
>> import com.sun.j3d.loaders.Loader;
>> import com.sun.j3d.loaders.Scene;
>> import com.sun.j3d.utils.geometry.*;
>> import com.sun.j3d.utils.applet.MainFrame;
>> import com.sun.j3d.utils.universe.SimpleUniverse;
>> import com.sun.j3d.utils.behaviors.vp.OrbitBehavior;
>>
>>
>> public class View extends Applet
>> {
>> String filename;
>> //java.net.URL url;
>> URL url;
>> public View(final String model)throws Exception
>> {
>> this.filename = model;
>> //this.filename = "macchina.dae";
>> System.out.println("costruttore view");
>>
>> setLayout(new BorderLayout());
>> Canvas3D canvas = createCanvas();
>> add("Center", canvas);
>> SimpleUniverse u = new SimpleUniverse(canvas);
>>
>> BranchGroup scene = createContent();
>>
>> OrbitBehavior orbit = new OrbitBehavior(canvas);
>> orbit.setSchedulingBounds(new BoundingSphere(new Point3d(10.0,
>> 10.0, 0.0), 10.0));
>> u.getViewingPlatform().setViewPlatformBehavior(orbit);
>>
>> TransformGroup vtg =
>> u.getViewingPlatform().getViewPlatformTransform();
>> Transform3D moveback = new Transform3D();
>> moveback.setTranslation(new Vector3f(0.0f, 0.0f, 10.0f));
>> vtg.setTransform(moveback);
>>
>> scene.compile();
>> u.getViewer().getView().setBackClipDistance(100.0);
>> u.addBranchGraph(scene);
>> }
>>
>> private Canvas3D createCanvas()
>> {
>> GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
>> GraphicsConfiguration gc1 =
>> GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(template);
>>
>> return new Canvas3D(gc1);
>> }
>>
>> private BranchGroup createContent()
>> throws Exception
>> {
>> System.out.println("loader");
>> Loader loader = new Collada14Loader();
>> //Loader loader = new MS3DLoader();
>> //Loader loader = new KmzLoader();
>>
>> // Use these 4 lines to load from a local file
>> java.io.File file = new java.io.File(filename);
>> System.out.println(file.getParent() + java.io.File.separator);
>> if (file.getParent() != null)
>> if (file.getParent().length() > 0) // figure out the base path
>> loader.setBasePath(file.getParent() + java.io.File.separator);
>> System.out.println(file.getName());
>> Scene scene = loader.load(file.getName());
>> BranchGroup group = scene.getSceneGroup();
>> createLights(group);
>> return group;
>>
>>
>> }
>>
>> private void createLights(BranchGroup graphRoot)
>> {
>> // Create a bounds for the light source influence
>> BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0,
>> 0.0), 100.0);
>>
>> // Set up the global, ambient light
>> Color3f alColor = new Color3f(1.0f, 1.0f, 1.0f);
>> AmbientLight aLgt = new AmbientLight(alColor);
>> aLgt.setInfluencingBounds(bounds);
>> graphRoot.addChild(aLgt);
>>
>> // Set up the point (infinite) light source
>> Point3f location = new Point3f(0.0f, 0.0f, 100.0f);
>> PointLight lgt1 = new PointLight(new Color3f(1.0f, 1.0f, 1.0f),
>> location,
>> new Point3f(1.0f, 0.0f, 0.0f));
>> lgt1.setInfluencingBounds(bounds);
>> graphRoot.addChild(lgt1);
>>
>> // create an Appearance and Material
>> Appearance app = new Appearance( );
>> Color3f objColor = new Color3f( 1.0f, 0.7f, 0.8f );
>> Color3f black = new Color3f( 0.0f, 0.0f, 0.0f );
>> app.setMaterial( new Material( objColor, black, objColor, black,
>> 80.0f ) );
>>
>> Sphere sphere = new Sphere(1.0f, Sphere.GENERATE_NORMALS, app);
>> // a sphere to represent the light source.
>> Transform3D trans = new Transform3D();
>> trans.setTranslation(new Vector3f(location));
>> TransformGroup tg = new TransformGroup();
>> tg.setTransform(trans);
>> tg.addChild(sphere);
>> graphRoot.addChild(tg);
>>
>> }
>> }
>
Re: Java 3d view Plug-in [message #788104 is a reply to message #788090] Wed, 01 February 2012 10:53 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Looks like you are referencing an external library not part of the JDK
and not part of your OSGi-Bundle.

How did you get to compile your code? I guess you simply modified the
Build-Path of your project which is not the correct solution. You need
to adjust your MANIFEST.MF.

Tom

Am 01.02.12 11:43, schrieb Federico Pozzoni:
> Another Error
> Quote:
>> eclipse.buildId=unknown
>> java.version=1.7.0_01
>> java.vendor=Oracle Corporation
>> BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=it_IT
>> Framework arguments: -product org.eclipse.amalgam.dsltk.product
>> Command-line arguments: -product org.eclipse.amalgam.dsltk.product
>> -data C:\Documents and
>> Settings\Federico\Desktop\dsltk\workspace\NEWVIEW2/../runtime-New_configuration
>> -dev file:C:/Documents and
>> Settings/Federico/Desktop/dsltk/workspace/NEWVIEW2/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties
>> -os win32 -ws win32 -arch x86
>>
>>
>> Error
>> Wed Feb 01 11:41:57 CET 2012
>> Unable to create view ID org.eclipse.j3d.view.ColladaView:
>> com/sun/j3d/loaders/Loader
>>
>> java.lang.ClassNotFoundException: com.sun.j3d.loaders.Loader
>> at
>> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:489)
>>
>> at
>> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
>>
>> at
>> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
>>
>> at
>> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
>>
>> at java.lang.ClassLoader.loadClass(Unknown Source)
>> at
>> org.eclipse.j3d.view.ColladaView.createPartControl(ColladaView.java:27)
>> at
>> org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:367)
>>
>> at
>> org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:226)
>> at
>> org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
>>
>> at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
>> at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:529)
>> at
>> org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
>>
>> at
>> org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
>>
>> at
>> org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
>>
>> at
>> org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
>>
>> at
>> org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256)
>>
>> at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:668)
>> at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:576)
>> at
>> org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:568)
>>
>> at
>> org.eclipse.ui.internal.PerspectiveHelper.activate(PerspectiveHelper.java:272)
>>
>> at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:981)
>> at
>> org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:2626)
>> at
>> org.eclipse.ui.internal.WorkbenchWindow$27.run(WorkbenchWindow.java:2964)
>> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
>> at
>> org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:2945)
>>
>> at
>> org.eclipse.ui.internal.WorkbenchWindow$21.runWithException(WorkbenchWindow.java:2262)
>>
>> at
>> org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
>>
>> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
>> at
>> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
>>
>> at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855)
>> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476)
>> at
>> org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
>>
>> at
>> org.eclipse.ui.internal.Workbench$28.runWithException(Workbench.java:1384)
>>
>> at
>> org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
>>
>> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
>> at
>> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
>>
>> at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855)
>> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476)
>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2316)
>> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
>> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
>> at
>> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>>
>> at
>> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
>>
>> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
>> at
>> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
>>
>> at
>> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
>>
>> at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
>>
>> at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
>>
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
>>
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
>> at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
>> at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
>
Re: Java 3d view Plug-in [message #788110 is a reply to message #788103] Wed, 01 February 2012 10:55 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Am 01.02.12 11:52, schrieb Tom Schindl:
> This looks like the pre 3.0 plugin way (older than 7 years!!!!)! You
> should switch to OSGi-Usage!
>
> Next problem is that you are using Swing and to embed this into SWT you
> need to do extra steps using the SWT-Awt-Bridge.
>
> Might I also suggest that you take a look at JavaFX 2.0 if you want to
> 3d stuff in Java?
>
> I'd suggest you start with one of the many only tutorials on writing a
>

.... eclipse plugin.

BTW - This has nothing to do with PDE so you should better ask questions
on the newcomer and/or platform newsgroups.

Tom
Re: Java 3d view Plug-in [message #788250 is a reply to message #788110] Wed, 01 February 2012 15:05 Go to previous messageGo to next message
Federico Pozzoni is currently offline Federico PozzoniFriend
Messages: 16
Registered: December 2011
Junior Member
Quote:
How did you get to compile your code? I guess you simply modified the
Build-Path of your project which is not the correct solution. You need
to adjust your MANIFEST.MF.


you're right about that but, how i can add my external jar into the manifest.mf?
Re: Java 3d view Plug-in [message #788885 is a reply to message #788250] Thu, 02 February 2012 10:34 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Am 01.02.12 16:05, schrieb Federico Pozzoni:
> Quote:
>> How did you get to compile your code? I guess you simply modified the
>> Build-Path of your project which is not the correct solution. You need
>> to adjust your MANIFEST.MF.
>
>
> you're right about that but, how i can add my external jar into the
> manifest.mf?

All I can do is to say that you should make yourself familiar with
plugin development e.g. http://www.vogella.de/eclipse.html and OSGi in
special.

There are multiple options:
a) copy the external jar to you plugin and ship it with your plugin
b) repackage the original jar as an OSGi-Bundle
c) Use the special Equinox Manifest Support with external:-syntax
d) Use adapter hooks like e(fx)clipse does it to integrate JavaFX from
an external source
e) customize the bootclass-path of the eclipse-instance
f) ...

c) & e) are only solutions if you control the target system, a) & b)
only if you are allowed to redistribute the jars.

I can only repeat once more that if you want to do 3d programming in
Java I'd advise you to not use java3d but switch to JavaFX 2.0 which
provides a SWT-Bridge out-of-the-box to include your 3D-Scene into an
Eclipse View, you are free to redistribute it with your application and
most important for someone who has not a lot of OSGi experience: you
already have an Eclipse/OSGi provided through e(fx)clipse' runtime Bundles.

Tom
Previous Topic:Deploying a JNI Application
Next Topic:Adding a Toc in help plugin as a child element for another toc
Goto Forum:
  


Current Time: Fri Apr 26 23:22:08 GMT 2024

Powered by FUDForum. Page generated in 0.03819 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top