How to use a netbeans "friend" module in own modules? - java

I'm trying to write a small module for netbeans.
Now, everything compiles, but when I try to run the module the follwing error occurs:
The module mtzoutgoings is not a friend of C:\Program Files (x86)\NetBeans 8.0.2\java\modules\org-netbeans-modules-java-j2seproject.jar
I've read that in the jar's MANIFEST.MF there is a section "OpenIDE-Module-Friends" in which all classes are referenced that are allowed to use the jar.
Hm. So, is there any way that I can use it for my module as well, without beeing a "friend" of the jar ?
thanks for any hint!
Thorsten

I'm developing a module for NetBeans. When I tried to run my module, I received the following error message:
The module my_module_name is not a friend of
/home/antonio/netbeans-8.2/php/modules/org-netbeans-modules-php-api-phpmodule.jar
What I did to get rid of that error message: I expanded Libraries, right-clicked PHP Module API and clicked Edit. In the dialog box, I checked Implementation Version and clicked OK.
Reference: https://markmail.org/message/qulevpr647bpvshg

Related

Eclipse asking for module named after the old project name

I'm trying to make my project modular on Eclipse, but I'm running into an issue. I have added the module-info.java file through right-clicking on the project > Configure > Create module-info.java. However, when I run, I get the error
Error occurred during initialization of boot layer
java.lang.module.FindException: Module serenitea-pot-manager not found
I believe this might be caused by having renamed the project to sereniteaPotManager at some point. Initially, the project name was serenitea-pot-manager, which is the name of the module being asked for. I did the renaming through right-clicking on the project > Refactor > Rename..., which should have updated all instances.
I have been searching for a while, but still haven't found a way to fix this. Is there anything else that I need to update on Eclipse for it to change to the correct module name?
Note: The module name included in module-info.java is indeed sereniteaPotManager.
I had the same problem. I will summarize my experience then my solution.
I did a rename of the module, and Eclipse kept wanting to use the old module name. Cleans, restarts, etc., did not help. A search of the project properties, the run configuration, and all files in the workspace, did not turn up an instance of the original module name. Editing the module name so that it matched the original one did work. It is as if Eclipse tucks away the initial module name in some hidden place and keeps wanting to use it.
I was able to solve the problem by deleting all Run configurations that existed and then creating a new project and new Run configuration.
I am using JavaFX, and a somewhat peculiar side-effect of this is that the normally-required run configuration argument (below) was not needed in this new run configuration. I wonder if Eclipse is tucking that away in some hidden place, also?
In Java, serenitea-pot-manager is an invalid module name since a module name must not contain hypens (-).
Therefore, In module-info.java, Eclipse shows Syntax error on token "-". So make sure, before running your application, no compile errors are shown in the Problems view.
Rename your module to serenitea_pot_manager, delete the existing launch configuration (in Run > Run Configurations...) and try again:
module serenitea_pot_manager {
// ...
}
https://stackoverflow.com/users/17416717/stevevzzz[Steves] solution worked for me while I got stuck with the same problem.
... but I did not create a new project. I only was able to solve the problem by deleting all Run Configurations that existed and then I created a new Run Configuration.
I noticed the same behaviour. After changing the module name of my project, I got the error
Error occurred during initialization of boot layer
java.lang.module.FindException: Module ... not found
It looks like eclipse holds on to the original module name that is used when first running the application using the Run Configuration. To work around this issue, I deleted and recreated the run configuration. Then it works again.

org.eclipse.core.runtime.CoreException: The class file is not on the classpath

from the beginning, while trying to deploy a war under Jetty, I have an error, and in order to understand from where the error is comming, I would like to put a breakpoint in a class (SimpleCDI) located in a dependency (a jar which is downloaded by MAVEN). I work under MAC and when I hit Command + Shift + T and look up "SimpleCDI" class, it points that the class is within org.jboss.weld package
Here is a printscreen of my research
And when I click on the "C SimpleCDI org.jboss.weld" line, it returns an error message
org.eclipse.core.runtime.CoreException: The class file is not on the classpath
at org.eclipse.jdt.internal.ui.javaeditor.ClassFileEditor.doSetInput(ClassFileEditor.java:694)
at org.eclipse.ui.texteditor.AbstractTextEditor$5.run(AbstractTextEditor.java:3154)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:437)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:353)
at org.eclipse.ui.internal.WorkbenchWindow$14.run(WorkbenchWindow.java:2195)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2191)
at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3172)
I checked that I have the right dependency (weld-servlet-2.4.5.Final.jar) with
SimpleCDI" in it.
I noticed that the eclipse icon of my dependency "weld-servlet-2.4.5.Final.jar" is the following
It is a jar file without attached source. Actually, I can see this dependency in Eclipse in one of my module "Tourism-Services" (I have a Maven multi module project) in the "Referenced Librairies" folder with the icon mentioned above, but the Maven dependency that import this jar is located in another module "Tourism-Core" which is imported itself in "Tourism-Services" module. I notice in passing that I cannot see "weld-servlet-2.4.5.Final.jar" in "Referenced Librairies" folder of "Tourism-Core" module (why ?)
My main question is : why cannot I edit "SimpleCDI" class and put a breakpoint in order to debug upstream
I've also been using the CodeMix plugin, have you tried to remove the Open Type binding from the CodeMix preferences? Preferences -> Codemix -> Bindings. From there uncheck the "Open Types on COMMAND+SHIFT+T" and do apply and close. This will get you to use the regular Open Java Type from Eclipse.
Cheers
a plugin was causing the error. It is CodeMix plugin
I tried to uninstall it : help->Eclipse Marketplace->Installed
I obtain the following screen
I chose uninstall in the dropDown
But it doesn't work.
I have found a workaround : https://www.genuitec.com/forums/topic/uninstall-codemix/
But it is temporary. I tried to find CodeMix in Eclipse plugin folder (I work under MAC), but there is nothing. Do you see another way ?

java.lang.NoClassDefFoundError: org.apache.http.client.CredentialsProvider error with HTMLUnit

I am getting the java.lang.NoClassDefFoundError:org.apache.http.client.CredentialsProvider error even after importing the Web client jar files.
Please find the screenshot below.
Can any one help me where I am going wrong.
Most of the time, NoClassDefFoundError happen when there is missing dependencies to your project. Note that there is other possibilities...
For more information on NoClassDefFoundError you might want to check this thread
Why am I getting a NoClassDefFoundError in Java?
In your case, as #Jens already mentionned, we can see in your referenced libraries that you are missing httpclient.jar
See the http components of Apache download page.
You have to add the httpclient.jar from apache to your classpath. You can download it here
java.lang.NoClassDefFoundError:org.apache.http.client.CredentialsProvider error indicates that httpclient-4.0.3.jar file is mission in your class path.
Configure it in your class path Right click project -> Build Path -> Configure Build Path -> Libraries -> Add Excernal Jars -> select jar file

Importing external library into eclipse - Android

I want to use the UnifiedPreference library in my app. I've imported the library into my workspace, then added the new project into my existing project by adding it as a library under Properties -> Android. However I'm getting the following errors when I try to build my project which are coming from the UnifiedPreference project:
Console:
[2013-04-08 23:06:29 - unified-pref-library] ERROR: In <declare-styleable> PreferenceHeader, unable to find attribute icon
[2013-04-08 23:06:29 - unified-pref-library] ERROR: In <declare-styleable> PreferenceHeader, unable to find attribute title
The relevent logcat errors seem to be:
PreferenceHeader_title cannot be resolved or is not a field UnifiedPreferenceHelper.java /unified-pref-library/src/net/saik0/android/unifiedpreference line 435 Java Problem
PreferenceHeader_title cannot be resolved or is not a field UnifiedPreferenceHelper.java /unified-pref-library/src/net/saik0/android/unifiedpreference line 299 Java Problem
Have I imported the library incorrectly? I've tried cleaning and building both projects without anything changing.
In Eclipse:
On the Package Explorer
Right click in your Proyect > Properties
Select: Java Build Path
Select and enable Android Dependencies
Put on the top in the list
Click: OK
Figured it out, seems UnifiedPreference requires a dependency for ActionBarSherlock. Thanks to tttony for putting me on the right track though.

How to compile MVC3 (razor ) Views including Some java files in Web Project

I want to compile views in my ASP.Net MVC3(razor) Project.
I have used this technique
Compile Views in ASP.NET MVC
Its working fine but problem is that when i do this, an error starts showing:
"The CodeDom provider type "Microsoft.VJSharp.VJSharpCodeProvider, VJSharpCodeProvider, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" could not be located."
When i dig more i found that this error occur when some java files included into project.
I have a printers plugin which is made on java(some .jar and other java related file). When i remove these files, everything starts working fine.
But problem is that, I cant remove these java files from my project because these have an important role in my application.
Is there any way that i can compile my Views with including java file into my project?
Any suggestion would be highly appreciated.

Categories