Mac OS X does not have sun.misc package

I am back after long time. Mi last works with jME was in the period jME was transitioning from jME 1.0 to jME 2.0.



I downloaded latests jME SVN and I am testing on my Mac, with Mac OS X Leopard 10.5.5. Apart the well known problem with SWT. My problem is of a different kind…


Description   Resource   Path   Location   Type
Access restriction: The constructor BASE64Decoder() is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar   SchemaBase64Binary.java   jme-svn-2.0/src/com/jmex/xml/types   line 57   Java Problem
Access restriction: The constructor BASE64Encoder() is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar   SchemaBase64Binary.java   jme-svn-2.0/src/com/jmex/xml/types   line 85   Java Problem
Access restriction: The constructor GetPropertyAction(String) is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar   BetterFormatter.java   jme-svn-2.0/src/com/jme/util/logging   line 22   Java Problem
Access restriction: The method decodeBuffer(String) from the type CharacterDecoder is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar   SchemaBase64Binary.java   jme-svn-2.0/src/com/jmex/xml/types   line 57   Java Problem
Access restriction: The method encode(byte[]) from the type CharacterEncoder is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar   SchemaBase64Binary.java   jme-svn-2.0/src/com/jmex/xml/types   line 85   Java Problem
Access restriction: The method providers(Class) from the type Service is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar   DisplaySystem.java   jme-svn-2.0/src/com/jme/system   line 195   Java Problem
Access restriction: The type BASE64Decoder is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar   SchemaBase64Binary.java   jme-svn-2.0/src/com/jmex/xml/types   line 57   Java Problem
Access restriction: The type BASE64Encoder is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar   SchemaBase64Binary.java   jme-svn-2.0/src/com/jmex/xml/types   line 85   Java Problem
Access restriction: The type GetPropertyAction is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar   BetterFormatter.java   jme-svn-2.0/src/com/jme/util/logging   line 22   Java Problem
Access restriction: The type Service is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar   DisplaySystem.java   jme-svn-2.0/src/com/jme/system   line 41   Java Problem
Access restriction: The type Service is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar   DisplaySystem.java   jme-svn-2.0/src/com/jme/system   line 195   Java Problem
Access restriction: The type ServiceConfigurationError is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar   DisplaySystem.java   jme-svn-2.0/src/com/jme/system   line 42   Java Problem
Access restriction: The type ServiceConfigurationError is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar   DisplaySystem.java   jme-svn-2.0/src/com/jme/system   line 192   Java Problem



These are not Runtime errors. These are problems signaled by Eclipse IDE. Basically I don't have any sun.misc package in my Java installation.

Though the runtime subsequent error is obviously:

26-set-2008 18.08.33 com.jme.app.BaseGame start
INFO: Application started.
26-set-2008 18.08.33 com.jme.system.PropertiesGameSettings <init>
INFO: PropertiesGameSettings created
26-set-2008 18.08.33 com.jme.system.PropertiesGameSettings load
AVVERTENZA: Could not load properties. Creating a new one.
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem:

   at com.jme.system.DisplaySystem.getSystemProviderIdentifiers(DisplaySystem.java:223)
   at com.jme.system.lwjgl.LWJGLPropertiesDialog.setUpRendererChooser(LWJGLPropertiesDialog.java:468)
   at com.jme.system.lwjgl.LWJGLPropertiesDialog.createUI(LWJGLPropertiesDialog.java:313)
   at com.jme.system.lwjgl.LWJGLPropertiesDialog.<init>(LWJGLPropertiesDialog.java:204)
   at com.jme.app.AbstractGame$1.run(AbstractGame.java:216)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:300)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:210)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:200)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:195)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:187)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)



Apart that I would be glad to know if there is any solution to this problem. I have some other questions.


  • What is this SWT stuff? Did you switched to SWT for some part of the jME window creation?

  • What is this sun.misc package? Has anybody a first idea of the reason Apple implementation does not have it?

  • sun.misc package is not documented in Java 1.6 official API, why?



Thanks
Ender said:


  • What is this SWT stuff? Did you switched to SWT for some part of the jME window creation?

  • What is this sun.misc package? Has anybody a first idea of the reason Apple implementation does not have it?

  • sun.misc package is not documented in Java 1.6 official API, why?




Some need SWT, for example MW3D, so its good to have an SWT binding in jME. You don't have to use it though.
The sun.misc.package is Sun proprietary API, thus is not documented and not garantued to be part of any JVM. Use of this package is strongly discouraged.
Vardamir said:
Some need SWT, for example MW3D, so its good to have an SWT binding in jME. You don't have to use it though.


I don't want to use it. It starts automatically. :)

Vardamir said:
The sun.misc.package is Sun proprietary API, thus is not documented and not garantued to be part of any JVM. Use of this package is strongly discouraged.


:-o sun.misc package is used by com.jme.system.DisplaySystem of the current jME SVN, for example (and other classes, you can see them in the first log).

This are line 41 and 42 of com.jme.system.DisplaySystem.

import sun.misc.Service;
import sun.misc.ServiceConfigurationError;



I think that DisplaySystem is a fundamental class in jME, ... or not? What is happening? Did I checkout the wrong source code?

I do not see any swt related issues in your stacks?  The sun.misc stuff was donated a long time ago and has been in jME for years.  I don't see any reason to use it though, as it is an undocumented, non-guaranteed to be there API.

I did not reported any SWT code, in fact. I resolved all the problems searching in the forum and using swt-fake.jar. I just asked if someone can tell me why it starts when I launch tests and for what reason it is there in the sources.



sun.misc errors never appeared to me when I used jME 0.7 to jME 1.0. Though, even if you don't see any reason to use it, sun.misc package is there in the source code and kills jME tests under Eclipse 3.4 on Leopard 10.5.5.



To be more precise, it don't kill the test, it only kills creation of DisplaySystem, line 223. I think that is not feasible to leave in jME a code that need some kind of special setup to be executed on a platform.



Though I read, on the internet, that also some Win users experimented same problems running other applications that try to use that sun.misc package.



Forgive my ignorance, but the problem is there. I ran jME 2.0 tests only.



My code still relies on jME 1.0. And (unbelievable!) jME 1.0 is there (i found the same import statements inside it, as you said) side by side with jME 2.0, but Eclipse outputs no errors about jME 1.0.



I will try to delete my local copy of jME 2.0 and re-checkout it.

sun.misc is not part of the jdk spec !!!

The package name indicates that.

No package in the sun.misc package is guaranteed to work on a non sun jdk (and the one on mac is not done by sun).

Ender said:

I did not reported any SWT code, in fact. I resolved all the problems searching in the forum and using swt-fake.jar. I just asked if someone can tell me why it starts when I launch tests and for what reason it is there in the sources.


Sorry, your swt comment was offtopic from the thread name and your stack traces, so I did not catch that you were saying it was a separate unrelated issue.  As for why it starts automatically, I do not know...  it is very annoying.  SWT support is there as a complement to AWT embed support - in other words, when you make a canvas to embed jME in, you can now choose if that will be an AWT canvas or an SWT one.  SWT is useful for Eclipse RCP applications as was mentioned above by Vardamir.

As for why 1.0 did not throw this issue, it could be that refactoring in 2.0 made this package more intimately tied into the code?  I am not sure though, and as I said in the last post, it seems that use of this package could/should be removed from jME.
pflanzenmoerder said:
No package in the sun.misc package is guaranteed to work on a non sun jdk (and the one on mac is not done by sun).


I perfectly know that Mac OS X JVM is made by Apple and not by Sun. Though, I verified that sun.misc is present in Apple implementation with all the classes required by jME.

After my last post, I deleted previous jME 2.0 checkout from Eclipse and from filesystem, and I tried to checkout it again.

Now, after usual setup in Eclipse IDE (the same configurations I made previously... I use Eclipse and jME since version 0.7, and I remember every single step, by now), Eclipse does not signal anymore the previous errors. :?

I am sorry I made you all loose your time but, at this point, I think that the problem is not jME but Eclipse.

Though, this strange bug, leaded us to some new argumentation... the sun.misc problem.
renanse said:
I am not sure though, and as I said in the last post, it seems that use of this package could/should be removed from jME.


Unfortunately I do not have the time and neither the deep knowledge of inner aspects of jME to remove that "dangerous" code. Though, if I will find (thanks to some miracle) how to remove it I will send you a patch :) .

"eclipse -clean" or "Projeckt->clean" are your friends.

With all the libraries inour app and especially after refactoring or adding new stuff I have to d this at least once a week.

Mine was a fresh installation of Eclipse. So, in my opinion, it would be quite strange if I needed to execute `eclipse -clean'. Also: I worked for years with Eclipse and jME < 2.0 and I never needed to launch that command.



My solution has been to execute every task (clean, build and run tests) from an Ant script. I have to launch it from Terminal; else, if I run the Ant script from inside Eclipse, I get almost same problems.

I have been using jME 2 on Leopard and Eclipse for quite some time now, without any of this. Weird problem…

I tried the `-clean', but it was not useful I had to exclude all SWT and JOGL stuff from the CLASSPATH and now I am able to run jmetest.base.TestSimpleGame and also my project tests.


Hello,

I have encountered the similar problem, when trying to build jME2.0 on Windows XP using standalone 'ant' from console.  Please help to resolve so that I can continue.  Here are the error messages:

D:DATAHongYuDataDevelopmentworkspacemd5reader2_sourceForgedependenciesjMo
nkeyEngine_2.0svnjme-svn-2.0>ant
Buildfile: build.xml
init:
    [echo] jmeKeyStore
    [mkdir] Created dir: D:DATAHongYuDataDevelopmentworkspacemd5reader2_sou
rceForgedependenciesjMonkeyEngine_2.0svnjme-svn-2.0build
    [mkdir] Created dir: D:DATAHongYuDataDevelopmentworkspacemd5reader2_sou
rceForgedependenciesjMonkeyEngine_2.0svnjme-svn-2.0datadoc
-gen-rtlogprops:
    [copy] Copying 1 file to D:DATAHongYuDataDevelopmentworkspacemd5reader
2_sourceForgedependenciesjMonkeyEngine_2.0svnjme-svn-2.0
compile:
    [copy] Copying 42 files to D:DATAHongYuDataDevelopmentworkspacemd5read
er2_sourceForgedependenciesjMonkeyEngine_2.0svnjme-svn-2.0build
    [copy] Copied 118 empty directories to 85 empty directories under D:DATAH
ongYuDataDevelopmentworkspacemd5reader2_sourceForgedependenciesjMonkeyEngin
e_2.0svnjme-svn-2.0build
    [javac] Compiling 820 source files to D:DATAHongYuDataDevelopmentworkspa
cemd5reader2_sourceForgedependenciesjMonkeyEngine_2.0svnjme-svn-2.0build
    [javac] D:DATAHongYuDataDevelopmentworkspacemd5reader2_sourceForgedepe
ndenciesjMonkeyEngine_2.0svnjme-svn-2.0srccomjmesystemDisplaySystem.java
:41: warning: sun.misc.Service is Sun proprietary API and may be removed in a fu
ture release
    [javac] import sun.misc.Service;
    [javac]                ^
    [javac] D:DATAHongYuDataDevelopmentworkspacemd5reader2_sourceForgedepe
ndenciesjMonkeyEngine_2.0svnjme-svn-2.0srccomjmesystemDisplaySystem.java
:42: warning: sun.misc.ServiceConfigurationError is Sun proprietary API and may
be removed in a future release
    [javac] import sun.misc.ServiceConfigurationError;
    [javac]                ^
    [javac] D:DATAHongYuDataDevelopmentworkspacemd5reader2_sourceForgedepe
ndenciesjMonkeyEngine_2.0svnjme-svn-2.0srccomjmesystemDisplaySystem.java
:192: warning: sun.misc.ServiceConfigurationError is Sun proprietary API and may
be removed in a future release
    [javac]            throws ServiceConfigurationError {
    [javac]                    ^
    [javac] D:DATAHongYuDataDevelopmentworkspacemd5reader2_sourceForgedepe
ndenciesjMonkeyEngine_2.0svnjme-svn-2.0srccomjmexaudioopenalOpenALAudio
Track.java:40: warning: sun.audio.AudioStream is Sun proprietary API and may be
removed in a future release
    [javac] import sun.audio.AudioStream;
    [javac]                ^
    [javac] D:DATAHongYuDataDevelopmentworkspacemd5reader2_sourceForgedepe
ndenciesjMonkeyEngine_2.0svnjme-svn-2.0srccomjmesystemDisplaySystem.java
:195: warning: sun.misc.Service is Sun proprietary API and may be removed in a f
uture release
    [javac]            Iterator<SystemProvider> displayProviders = Service.prov
iders(SystemProvider.class);
    [javac]                                                        ^
BUILD FAILED[/i][/i][/color]

Hong Yu

On windows those are just warnings which can be ignored.

Your build failed because of some other errors.


Rebuild again seem successful, from the log file.  Thanks.

Hong Yu

I got the same problem on Vista, the problem seems to be with the JRE that comes with Eclipse.

Rebuilt with JRE from SUN and everything works.

I got the same problem on Vista, the problem seems to be with the JRE that comes with Eclipse.
Rebuilt with JRE from SUN and everything works.


You mean SDK don't you :wink:

Maybe Eclipse ships the OpenJDK, which doesn't include SUN's proprietary libs wich SunJDK does include.

Just a guess though.
tim8dev said:

I got the same problem on Vista, the problem seems to be with the JRE that comes with Eclipse.
Rebuilt with JRE from SUN and everything works.


You mean SDK don't you :wink:

Maybe Eclipse ships the OpenJDK, which doesn't include SUN's proprietary libs wich SunJDK does include.

Just a guess though.


I don't remember how Eclipse builds Java but I do remember that it only ships with the JRE not JDK.
I don't remember how Eclipse builds Java but I do remember that it only ships with the JRE not JDK.


And I can't figure out, how you compile a Java-Program with JRE  :D

Hi there,



I decided to have a play with jME today, but cannot get it to compile on my mac inside Eclipse. I'm having exactly the same problem as Ender was at the beginning of this post (the sun.misc issue), but I don't quite understand what was done to resolve the issue. Can anyone explain?



Much appreciated,

J