'DataNucleus Enhancer' Error 206 - java

I have a problem. I always get an Error 206 from Java DataNucleus Enhancer, since 2 days ago... days before, it worked without errors.
Cannot run program "D:\Program Files\Java\jre6\bin\javaw.exe" (in
directory "C:\Users\schmisa2\workspace\AMS0"): CreateProcess
error=206, The filename or extension is too long Cannot run program
"D:\Program Files\Java\jre6\bin\javaw.exe" (in directory
"C:\Users\schmisa2\workspace\AMS0"): CreateProcess error=206, The
filename or extension is too long
I searched a lot at Google and Stackoverflow but could not solve the problem.
My longest path is:
C:\Users\schmisa2\workspace\AMS0\src\ch\zhaw\ams\module\football\sfv\news\server\NewsElement.java
https://groups.google.com/group/google-appengine-java/browse_thread/thread/6cde7d1695b3eff3
Does somebody know how I can fix it?
I installed a Linux Ubuntu to test it there. There it was no problem... but it doesn't work on Windows 7.
I have GWT 2.4, App engine 1.6.5. SDK and Eclipse 3.7
Or can someone explain me how to run it on command line?

This worked for me.
"If you're using eclipse plugin go to Project | Properties, choose
Google \ App Engine \ ORM and only include directories that you have
classes that you want enhanced. By default it does the entire project
so that includes a lot of needless files."
Source here

I have a project which I was using DataNucleus, JDO and Annotations. I ran into the same issue on Windows with Eclipse (It was fine on my Mac). To fix, I did the following:
Created a .jdo file for each #PersistenceCapable class (see example JDO file below) and kept them alongside the class files.
Right-click project -> Preferences -> DataNucleus -> Enhancer -> Input File Extensions. Remove the "class" entry here.
Do the same as above for the SchemaTool configuration if this is also required for your project.
This should now work.
JDO file example:
<?xml version="1.0" encoding="UTF-8"?>
<jdo>
<package name="my.package">
<class name="MyPersistenceCapableClass"/>
</package>
</jdo>

So you hit Windows antiquated limits on command line length. Change the invocation of the enhancer to use a persistence.xml for example.

Another way you can fix this issue or workaround it I should say in Eclipse is to create a new run configuration in eclipse copying the parameters from the datanucleus one which is created by the plugin Run Configurations -> Java Application -> DataNucleus Enhancer. Copy Main tab, Arguments, and you might need to add the Datanucleus jars to the classpath tab.
In the arguments tab, remove all the classes you don't need enhanced. Next I'll shut off the plugin by removing the classes extension under the projects Properties -> DataNucleus -> Enhancer -> Input File Extensions.
You'll just need to manually run this enhancer after each time you build now. If I need to add new classes to enhance, I'll just add it to my manual one.

Related

Why is Visual Studio trying to use the wrong JDK version?

I am trying to build WeatherApp, which comes from this tutorial, but I am seeing this error:
The specified task executable location "C:\Program Files (x86)\Java\jdk1.7.0_55\bin\javac.exe" is invalid.
and this warning (not sure if they are related):
Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding>
I can doube-click the warning to make it go away, but the error remains. I am not sure why the project is trying to use that version of the jdk, as I have changed my xamarin optioins to point at Program Files instead:
Why is Visual Studio trying to use that versioin of the JDK?
Sometimes there's a sdk.caches file that will hold an old reference. Please try to delete both your obj/bin folders and see if that resolves the issue. If it doesn't, turn up your Build Output verbosity and attach a Build Output Log to your post:
https://forums.xamarin.com/discussion/27515/how-to-obtain-diagnostic-build-logs (XS)
http://blogs.msdn.com/b/msbuild/archive/2005/09/29/475157.aspx (VS)

Your active platform is: default_platform, but the corresponding property "platforms.default_platform.home" is not found

Im currently developing JavaFX applications. I used Netbeans 7.4 before but now I switch to Netbeans 8.0.2. After running my project with the new IDE, an error occured saying:
C:\projects\client\QueueBoard\nbproject\build-impl.xml:87: The J2SE Platform is not correctly set up.
Your active platform is: default_platform, but the corresponding property "platforms.default_platform.home" is not found in the project's properties files.
Either open the project in the IDE and setup the Platform with the same name or add it manually.
For example like this:
ant -Duser.properties.file=<path_to_property_file> jar (where you put the property "platforms.default_platform.home" in a .properties file)
or ant -Dplatforms.default_platform.home=<path_to_JDK_home> jar (where no properties file is used)
BUILD FAILED (total time: 0 seconds)
How do you resolve this?
The easiest way to resolve this problem is:
open the Project in NetBeans
open Project-Settings for this project
check (and maybe correct/fix) all settings (including Platform-Settings)
click on Save/OK in settings dialog
Clean+Build project
By doing this, project-settings-file will be updated to current settings.
Cheers!
I know this is a very old question, but I encountered this recently. The solution I came up with is to modify the user-editable build.xml file (which is usually one directory up from build-impl.xml) and add the following after the <import> of build-impl.xml:
<property name="platforms.default_platform.home"
location="${java.home}/.."/>
This allows any user/local settings to have precedence, but if not defined, the java used should be the same java that is executing Ant.
This problem still exists in Netbeans 15 and can be solved by updating the nbproject/private/private.properties file and ensure this row exists:
javac.debug=true

Access restriction: The type 'Application' is not API (restriction on required library rt.jar)

Here is the code:
package mscontroller;
import javax.swing.*;
import com.apple.eawt.Application;
public class Main {
public static void main(String[] args)
{
Application app = new Application();
app.setEnabledAboutMenu(true);
AMEListener listener = new AMEListener();
app.addApplicationListener(listener);
JFrame mainFrame = new JFrame("Application Menu Example");
mainFrame.setSize(500, 500);
mainFrame.setVisible(true);
}
}
here is the error:
Exception in thread "main" java.lang.Error: Unresolved compilation
problems: Access restriction: The type 'Application' is not API
(restriction on required library
'/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/rt.jar')
Access restriction: The constructor 'Application()' is not API
(restriction on required library
'/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/rt.jar')
Access restriction: The type 'Application' is not API (restriction on
required library
'/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/rt.jar')
Access restriction: The method
'Application.setEnabledAboutMenu(boolean)' is not API (restriction on
required library
'/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/rt.jar')
AMEListener cannot be resolved to a type AMEListener cannot be
resolved to a type
at mscontroller.Main.main(Main.java:9)
eclipse says this:
Access restriction: The type 'Application' is not API (restriction on required library '/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/rt.jar')
This happened to me as well, and the answers given here already were not satisfying, so I did my own research.
Background: Eclipse access restrictions
Eclipse has a mechanism called access restrictions to prevent you from accidentally using classes which Eclipse thinks are not part of the public API. Usually, Eclipse is right about that, in both senses: We usually do not want to use something which is not part of the public API. And Eclipse is usually right about what is and what isn't part of the public API.
Problem
Now, there can be situations, where you want to use public Non-API, like sun.misc (you shouldn't, unless you know what you're doing). And there can be situations, where Eclipse is not really right (that's what happened to me, I just wanted to use javax.smartcardio). In that case, we get this error in Eclipse.
Solution
The solution is to change the access restrictions.
Go to the properties of your Java project,
i.e. by selecting "Properties" from the context menu of the project in the "Package Explorer".
Go to "Java Build Path", tab "Libraries".
Expand the library entry
select
"Access rules",
"Edit..." and
"Add..." a "Resolution: Accessible" with a corresponding rule pattern.
For me that was "javax/smartcardio/**", for you it might instead be "com/apple/eawt/**".
I was having the same problem. When I initially created the java project in Eclipse I specified JRE 8. When I went into the project's build path and edited the JRE System Library, the Java 8 execution environment was selected. When I chose to use an "Alernate JRE" (still java 8) it fixed the error for me.
Adding javafx accessible permission in eclipse oxygen
go to project> properties> java build path> libraries> then expand the libraries and double click on> Access rules there you set the permission
Resolution : Accessible
Rule Pattern : javafx/**
To begin with (and unrelated), instantiating the Application class by yourself does not seem to be its intended use. From what one can read from its source, you are rather expected to use the static instance returned by getApplication().
Now let's get to the error Eclipse reports. I've ran into a similar issue recently: Access restriction: The method ... is not API (restriction on required project). I called the method in question as a method of an object which inherited that method from a super class. All I had to do was to add the package the super class was in to the packages imported by my plugin.
However, there is a lot of different causes for errors based on "restriction on required project/library". Similar to the problem described above, the type you are using might have dependencies to packages that are not exported by the library or might not be exported itself. In that case you can try to track down the missing packages and export them my yourself, as suggested here, or try Access Rules. Other possible scenarios include:
Eclipse wants to keep you from using available packages that are not part of the public Java API (solution 1, 2)
Dependencies are satisfied by multiple sources, versions are conflicting etc. (solution 1, 2, 3)
Eclipse is using a JRE where a JDK is necessary (which might be the case here, from what your errors say; solution) or JRE/JDK version in project build path is not the right one
This ended up as more like a medley of restriction-related issues than an actual answer. But since restriction on required projects is such a versatile error to be reported, the perfect recipe is probably still to be found.
We had to change our application to build against the JDK 1.8 using Window->Preferences->Java->Installed JREs. However, after changing that, the JRE System Library specified in the Project Explorer was still incorrect. To fix this, right click on "JRE System Library [wrong-jre-here]" and change from Execution environment: to "Workspace Default (yer-default-here)"
I had this problem because the project facet associated with my project was the wrong java version.
To fix this is I did the following:
Right click on the project and select Properties
Select 'Project Facets' and change version of java to something greater than 1.4.
Click [Apply]
This will rebuild your project and hopefully the error will be resolved.
It worked: Project Properties -> ProjectFacets -> Runtimes -> jdk1.8.0_45 -> Apply
In the Eclipse top menu bar:
Windows -> Preferences -> Java -> Compiler -> Errors/Warnings ->
Deprecated and restricted API -> Forbidden reference (access rules): -> change to warning
If you're having this same issue using Spring Tool Suite:
The Spring Tool Suite's underlying IDE is, in fact, Eclipse. I've gotten this error just now trying to use some com.sun.net classes. To remove these errors and prevent them from popping up in the Eclipse Luna SR1 (4.4.2) platform of STS:
Navigate to Project > Properties
Expand the Java Compiler heading
Click on Errors/Warnings
Expand deprecated and restricted API
Next to "Forbidden reference (access rules)" select "ignore"
Next to "Discouraged reference (access rules)" select "ignore"
You're good to go.
Had the same problem. Here's how I solved it:
Go to Package Explorer. Right click on JRE System Library and go to Properties. In the Classpath Container > Select JRE for the project build path select the third option (Workspace default JRE).
Source : https://thenewboston.com/forum/topic.php?id=3917
We use IBM Rational Application Developer (RAD) and had the same problem.
ErrorMessage:
Access restriction: The type 'JAXWSProperties' is not API (restriction on required library 'C:\IBM\RAD95\jdk\jre\lib\rt.jar')
Solution:
go to java build path and under Library tab, remove JRE System Library. Then again Add Library --> JRE System Library
Go to the following setting:
Window -> Preferences -> Java-Compiler-Errors/Warnings-Deprecated and restricted API-Forbidden reference (access rules)
Set it to Warning or Ignore.
In Eclipse Mars.2 Release (4.5.2):
Project Explorer -> Context menu -> Properties -> JavaBuildPath -> Libraries
select JRE... and press Edit: Switch to Workspace JRE (jdk1.8.0_77)
Works for me.
Even if its old question, for me in Eclipse I just right click on Src folder and properties (Alt+Enter) and the check for the Ignore optional compile problems removed the error.
I have eclipse JRE 8.112 , not sure if that matters but what i did was this:
Right clicked on my projects folder
went down to properties and clicked
clicked on the java build path folder
once inside, I was in the order and export
I checked the JRE System Library [jre1.8.0_112]
then moved it up above the one other JRE system library there (not sure if this mattered)
then pressed ok
This solved my problem.
I simply just add e(fx)clipse in eclipse marketplace. Easy and simple
Remove Existing/Configured System Library:
Eclipse(IDE) -> Project Explorer -> Project Name-> (Option) Build Path -> Configure Build Path -> Java Build Path -> Libraries -> (Select) JRE System Library [(For me)jre1.8.0_231] -> Remove.
Currently you are at same location:
Eclipse(IDE) -> Project Explorer -> Project Name-> (Option) Build Path -> Configure Build Path -> Java Build Path -> Libraries
Now Add Same System Library Again:
Add Library -> JRE System Library -> Workspace default JRE ((For me)jre1.8.0_231) -> Finish -> Apply -> Close.
Now wait to finish it.
I'm using eclipse neon 3. I just wanted to use javafx.application.Application, so I followed Christian Hujer's answer above and it worked. Just some tips: the access rules are very similar to the import statement. For me, the access rules I added was "javafx/application/**". Just replace the dot in the import statement with forward slash and that's the rule. Hope that helps.
I had a little different problem. In Project - Properties - Libraries - JRE library, I had the wrong JRE lib version. Remove and set the actual one, and voila - all Access restriction... warnings are away.
If someone is having this issue only in your CI tool while running maven, what did the trick for me was to explicitly define the execution environment in your MANIFEST.MF.
In my case, I did this by inserting the following line in my OSGi bundle manifest file:
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
What worked for me was adding the access restricted package to the MANIFEST.MF file. In Eclipse, the "Access Restricted" errors showed up in the Problems tab for several files. I just right clicked on each error, clicked "Quick Fix", and chose "Add '[package]' to imported packages".
I had faced the same error on Eclipse 4.20.0 with JRE 1.8. To get rid of this compilation error, do the following:
Project --> Properties --> Java Compiler --> Errors/Warnings --> Deprecated and Restricted API --> Forbidden Reference (access rules) --> ignore

Eclipse can't find / load main class

My Eclipse (Indigo) was running just fine. I created a simple class Hello. It is placed in package cont in the folder ch13. However, when I try to run it from Eclipse I get info from Java Virtual Machine Launcher:
Could not find the main class: cont.Hello.
I tried to run other classes from this package and they run just fine (that is the classes that existed there before). However any new class I create in this package has these problems. Actually any new class I create in Eclipse runs into this problems. I decided to check how it works from the command line. It seems that the problem still exist - I get same error. I checked the path and it is C:\Program Files\Java\jdk1.7.0_02\bin, which is correct (note the other classes are running from Eclipse just fine). I tried to run with java -cp . Hello and there are some Errors produced starting with java.lang.NoClassDefFoundError: Hello (wrong name: cont/Hello). Code itself is simple:
package cont;
public class Hello {
public static void main(String[] args){
System.out.println("Hello");
}
}
How can I fix it so that my classes still run under Eclipse?
.metadata is corrupted.
Steps:
Warning: Deleting .metadata will delete all your Eclipse configurations, plugins, project setups. Make a backup before you attempt this!
Stop eclipse, delete .metadata in workspace and restart eclipse
Import Project
Run again
Removing the Run Configuration
Sometimes I have a similar problems in some pre-release versions of eclipse. For fix the error, I delete the Run Configuration. You can find that in menu Run, Run Configurations...
Then I launch the app with Alt+Shift+X, then J. If this don't work, Ctrl+F11.
Deleting the .metadata directory
In another way, the configuration settings for your current workspace may are corrupted. Those settings are in the .metadata directory in your current workspace 1. In that case, there is no other choice than delete the directory:
Close eclipse.
Delete the .metadata directory.
Start eclipse.
Import the projects.
Run the project again.
Notes
You will see that directory with File > Switch Workspace > Other...
I have solved the issue following way:
Go to Run Configuration (Right Click on Java File->Run->Run Configuration).
Go to ClassPath Tab:
Click on Advanced -> Add Folders -> Add bin directory (which has class file in it for Java source code)
Re run the code, now it will solve the issue. It worked for me
Note: This worked in the past and I received many up votes. Perhaps this is not a solution anymore - but it once was - as the eclipse version was indicated.
Problem
This can also be caused by a Java Build Path Problem.
In my case, I had a an error:
A cycle was detected in the build path of project {project}. The cycle consists of projects {x, y, z}.
This can occur when you include other projects in the build path of the project you wish to run. In fact, all the projects will fail to run with the error
Could not find the main class: Example.class
Solution
Open
Windows -> Preferences -> Java-> Compiler -> Building -> Build Path Problems
Uncheck the Abort build when build path errors occur toggle
This seems like a can of worms if you end up with other build path errors I image. So use with caution.
Note: This only works if you have a "cycle error". This error message can be found in the "Markers" tab
I found the solution to this here
Info
Java 1.8.0_152
Eclipse Photon (June 2018)
Renaming the main class should be enough (and easiest):
- Go to your class and set cursor to your class name;
- ALT + Shift + R and rename the class (build if not done automatically);
- You should be able to run it now;
- Rename the class to the old name if you want;
You must have main function in your class. Like
public class MyDataBase {
public static void main(String args[]) {
}
}
I had this same problem in a Maven project. After creating the src/test/java folder within the project the error went away.
Another tip: I initialized static fields in a wrong order - surprisingly it didn't bring up a Problem (NullPointerException?), instead Eclipse complained with exactly the message OP posted. Correcting the static initialization order made the class run-able. Example:
private static ScriptEngineManager factory = null;
private static ScriptEngine engine = null;
static {
engine = factory.getEngineByName("JavaScript");
// factory is supposed to initialize FIRST
factory = new ScriptEngineManager();
}
I found the way to fix this problem was to rename the project. If you give it a name with strange characters (in my case, :), it will have trouble locating your class. I don't know if this rule applies to numbers, but try renaming the project or making a new one and copying the files. Name it without any numbers or special characters.
I solved this error by closing the project, removing it from eclipse and then importing it again.
Might be a little simpler than to redo the whole workspace setup.
I had this issue after upgrading to the Eclipse 2019-12 release. Somehow the command line to launch the JVM got too long and I had to enable the jar-classpath option in the run configuration (right click on file -> run as -> run configs).
I read so many blogs and tried so many tricks but my problem not resolved. I was able to run the code but not able to generate the jar file. :( Sad..
But I tried something which might be very silly but worked for me and bought eclipse on trace. What I did was..
Just deleted the main method from the class. Saved it. Did undo to bring the main class back. Tada... Issue resolved...
Just one think would like to say, keep your eclipse in "Build Autometically" mode.
Move your file into a subdirectory called cont
Standard troubleshooting steps for Eclipse should include deleting and re-importing the project at some point, which when I have dealt with this error has worked.
I solved my issue by doing this:
cut the entire main (CTRL X) out of the class (just for a few seconds),
save the class file (CTRL S)
paste the main back exactly at the same place (CTRL V)
Strangely it started working again after that.
It is possible to have 2 groovy-xxx-all.jar files by excample in lib directory. which makes that an app is not running
I had the same problem, this is my solution:
I manually deleted the bin folder of the project
Then I refreshed the project which recompiled the whole project and created a new bin with all .class files
I did it because when I performed Clean(project->clean) my .class files were not getting deleted. the above solution works for me hope its useful to others.
I had the same problem.I solved with following command maven:
mvn eclipse:eclipse -Dwtpversion=2.0
PS: My project is WTP plugin
If you are using a pre-defined run configuration, go to classpath and try "Restore Default Entries". This will reconfigure the classpath for that configuration.
This worked for me finally :
RUN -> RUN CONFIGURATIONS -> DELETE THE RUN CONFIGURATION
CLOSE ECLIPSE
REOPEN ECLIPSE
CREATE RUN CONFIGURATION AGAIN.
Tadaaaa !! It works

Stuck at converting/implementing Qt (.ui) files to Qtjambi(.jui) files

Edit 01.02.2012:
FWIW: 4.7.0 linux packages are broken AFAIK, they
can be fixed or 4.6 packages used instead...
No need to use
custom Qt for Jambi – Smar 2 days ago
Thanks to SMAR, I was finally able to resolve this
issue by downloading the an older version of
qtjambi 4.6.3 ( http://qt-jambi.org/downloads/ ). The only problem was that the
designer did not know where to find my jvm which
I solved by adding these two entries to /etc/bash.bashrc:
# custom PATH exports
export JAVA_HOME=/usr/lib/jvm/java-6-sun
PATH=$PATH:$JAVA_HOME/bin
Then I just had to run (everything was in the qtjambi-folder):
designer.sh --> save it as .jui --> convert it with juic into a .java file --> and load it with netbeans :)
Hope this is somehow helpful to others too.
Thanks for the great and fast help!
Original post:
Good evening,
I am not completely sure if this topic is enough about programming but I am having some problems setting up Qtjambi. I have followed a lot of "howtos" and instructions so I am a little confused about what to do next. Qtjambi works as I have written a example program with netbeans. Although I have created some ui files that I want to implement which doesnt work.
I am trying to get this to run for like a week and I really need this because of my finals in 2 months. I try to give as much useful details as possible.
I am using LinuxMint (ubuntu derivate), downloaded qtjambi v 4.7.0
after trying out
bash qtjambi.sh
I got an error of mismatching versions
Cannot mix incompatible Qt library (version 0x40704) with this library (version 0x40700)
So I downloaded, compiled and installed
qt-everywhere-opensource-src-4.7.0 to /usr/local/Trolltech/Qt-4.7.0/
I know that I have to tell the system where to find all the binarys so I added to the /etc/bash.bashrc
#custom PATH exports
PATH=$PATH:/home/michi/Scripts
PATH=$PATH:/usr/local/Trolltech/Qt-4.7.0/bin/
export LD_LIBRARY_PATH=/usr/local/Trolltech/Qt-4.7.0/lib
export QT_PLUGIN_PATH=/usr/local/Trolltech/Qt-4.7.0/plugins
JAVA_DIR=/usr/lib/jvm/java-6-sun-1.6.0.26/
export JAMBI_PATH=/usr/local/lib/qtjambi-linux64-community-4.7.0/
I followed through the instructions of:
http://www.davidlauzon.net/2010/01/getting-started-with-qt-jambi-on-linux/
Which generally talks about getting jambi-designer to work.
http://jpnurmi.kapsi.fi/blog/2008/03/16/how-to-switch-qt-version-in-ubuntu/
How to manage multiple Qt versions.. These commands worked but had no effect
I finally gave up on trying to run the designer and tried to "convert" the .ui files to .jui files with the program juic which is located in the qtjambi/bin folder. But also here I get an error:
michi#BALMORA ~/Documents/unterlagen/pr_scw/Qt/Qtrainer/test $ which juic
/usr/local/bin/juic
michi#BALMORA ~/Documents/unterlagen/pr_scw/Qt/Qtrainer/test $ juic -cp .
juic: no .jui files found in CLASSPATH
michi#BALMORA ~/Documents/unterlagen/pr_scw/Qt/Qtrainer/test $ /usr/locallib/qtjambi-linux64-community-4.7.0/bin/juic -cp .
juic: no .jui files found in CLASSPATH
It would be great if you could help/guide or redirect me to "better" instructions.
Michael Kargl

Categories