I've been attempting to export my new Java code from Eclipse into a JAR and have been having issues with the JSON Libraries. At first, I exported using my current JDK, which would compile for Java 15. However, when I attempted to run it, it would not work because my JRE is Java 1.8. Then I changed the environment in Eclipse to 1.7, as apparently my code had some incompatibilities with 1.8, and since then, I'm able to export to a JAR file that runs and starts my GUI, but each time it crashed because it cannot find the JSON classes as the following stacktrace shows: Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: org/json/JSONException         at aoClient.AoApi.&lt;init&gt;(AoApi.java:10)         at aoClient.Main.main(Main.java:224) Caused by: java.lang.ClassNotFoundException: org.json.JSONException         at java.net.URLClassLoader.findClass(Unknown Source)         at java.lang.ClassLoader.loadClass(Unknown Source)         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)         at java.lang.ClassLoader.loadClass(Unknown Source)  I tried to use a different version of JSON in the Maven POM file, without success, and I have tried linking the JAR file of the JSON library to my build path, and even checking the order and export tab of the build path with no change. I've attempted to use different versions of JSON in Maven, and to remove JSON from Maven to only have the libraries added by Java. I've also tried running Maven install rather than Eclipse export to JAR, but I'm still getting the same error. And finally, and probably the most infuriating part is that when I run the program from Eclipse, it works perfectly. I also tried to disable Maven from the project and manually adding the two libraries I'm using through the build path, and I get the exact same result. And it may be useful to know that I noticed that no images are loading even though they are called before aoClient.AoApi I'm running windows 10 and eclipse 2020-12 with java 1.8.0_281 as my JRE. Can anyone explain to me why this doesn't work and how I can fix it?
3328
I want to package my project in a single executable JAR for distribution.  How can I make a Maven project package all dependency JARs into my output JAR?
107771
I want to simplify my execution of a Groovy script that makes calls to an Oracle database. How do I add the ojdbc jar to the default classpath so that I can run:  groovy RunScript.groovy   instead of:  groovy -cp ojdbc5.jar RunScript.groovy
108868
I have a Jar file, which contains other nested Jars. When I invoke the new JarFile() constructor on this file, I get an exception which says:     java.util.zip.ZipException: error in opening zip file   When I manually unzip the contents of this Jar file and zip it up again, it works fine.  I only see this exception on WebSphere 6.1.0.7 and higher versions. The same thing works fine on tomcat and WebLogic.   When I use JarInputStream instead of JarFile, I am able to read the contents of the Jar file without any exceptions.
16794
I installed Java JDK on Ubuntu 12.04 and added Java home to my path at ~/.bashrc:  export PATH=/opt/jdk1.7.0_40/jdk1.7.0_40/bin:$PATH   This looks a little bit strange but it's really my path.  After this I installed maven through:  sudo apt-get install maven   It installed all the needed libraries and now when I run mvn -version, I see:  Error: JAVA_HOME is not defined correctly.   We cannot execute /opt/jdk1.7.0_40/bin/java   What is wrong with it?   How to solve this trouble?
107891
I'm running an Ubuntu 14.04 and want to install the Eclipse IDE for both Java and C/C++ programming. I installed the separate installation files from their official website. I followed this thread . (The top answer)   The steps helped me install the Java IDE but I don't know what changes I should make to the procedure to install the C/C++ IDE.   Another thread , recommended to install eclipse-cdt but the Eclipse version installed is outdated. (Doesn't allow me to install Pydev)   I have TWO questions:   Can the C/C++ libraries be downloaded from within eclipse, like Pydev? If not, how do I install both IDEs without interfering with each other?   P.S. I commented this query in the first thread but got no reply, that is why I'm asking a fresh question!
35127
The cucumber feature file has all steps highlighted in yellow and warning is shown as step does not have matching glue code, When I try to run the project as maven test, I am getting null pointer exception for all steps. [Feature[Steps  Test Runner class: package com.vtiger.CucumberFramework.testRunner;  import org.junit.runner.RunWith;  import io.cucumber.junit.Cucumber; import io.cucumber.junit.CucumberOptions;  @RunWith(Cucumber.class) @CucumberOptions(                 features = &quot;classpath:features&quot;,                 glue = {&quot;com.vtiger.CucumberFramework.stepDefinitions&quot;,&quot;com.vtiger.CucumberFramework.testRunner&quot;},                  plugin = { &quot;pretty&quot;,&quot;html:target/cucumber-reports/cucumber-pretty&quot;,                             &quot;json:target/cucumber-reports/CucumberTestReport.json&quot;,                            &quot;rerun:target/cucumber-reports/rerun.txt&quot; },                 monochrome = true)  public class TestRunner {  }
28359
I'm trying to build an Android test application integrated to the SalesForce platform. I have downloaded the SDK from , and imported it to my workspace. Everything works fine except my test app, even the  they have provided along with the SDK work without problem. As a first step, what I tried was to clone the basic features (just login as of now) from the RestExplorer app. The following are my important files.  public class Home extends Activity {  private PasscodeManager passcodeManager; private RestClient client; private TokenRevocationReceiver tokenRevocationReceiver;  RestClient getClient() {     return client; }  @Override protected void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);      passcodeManager = SalesforceSDKManager.getInstance().getPasscodeManager();     tokenRevocationReceiver = new TokenRevocationReceiver(this);     setContentView(R.layout.activity_home);  }  @Override  public void onResume() {     super.onResume();     registerReceiver(tokenRevocationReceiver, new IntentFilter(ClientManager.ACCESS_TOKEN_REVOKE_INTENT));           if (passcodeManager.onResume(this)) {   // Bring up passcode screen if needed         String accountType = SalesforceSDKManager.getInstance().getAccountType();   // Login options         new ClientManager(this, accountType, SalesforceSDKManager.getInstance().getLoginOptions(), SalesforceSDKManager.getInstance().shouldLogoutWhenTokenRevoked()).getRestClient(this, new RestClientCallback() {    // Get a rest client             @Override             public void authenticatedRestClient(RestClient client) {                 if (client == null) {                     SalesforceSDKManager.getInstance().logout(Home.this);                     return;                 }                 Home.this.client = client;                           }         });     } }  @Override protected void onPause() {     passcodeManager.onPause(this);     unregisterReceiver(tokenRevocationReceiver);     super.onPause(); } }   I have added the permissions as required  &lt;permission android:name="com.salesforce.samples.restexplorer.C2D_MESSAGE"     android:protectionLevel="signature" /&gt;  &lt;uses-permission android:name="com.salesforce.samples.restexplorer.C2D_MESSAGE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt; &lt;uses-permission android:name="android.permission.GET_ACCOUNTS"/&gt; &lt;uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/&gt; &lt;uses-permission android:name="android.permission.ACCOUNT_MANAGER"/&gt;   And extended the application object to give a call to init();  public class MyApp extends Application { @Override public void onCreate() {     super.onCreate();     SalesforceSDKManager.initNative(getApplicationContext(), new KeyImpl(), Home.class); } }   Now, I'm getting the error in my Android debug log. The log as I see is attached below. It keep the activity restarting till I forcefully kill the application.  11-08 15:56:23.883: I/ClientManager:getRestClient(9334): No account of type com.salesforce.androisdk found 11-08 15:56:23.898: W/AccMgrCallback:run(9334): android.accounts.AuthenticatorException: bind failure 11-08 15:56:23.898: W/AccMgrCallback:run(9334):     at android.accounts.AccountManager.convertErrorToException(AccountManager.java:1726) 11-08 15:56:23.898: W/AccMgrCallback:run(9334):     at android.accounts.AccountManager.access$400(AccountManager.java:144) 11-08 15:56:23.898: W/AccMgrCallback:run(9334):     at android.accounts.AccountManager$AmsTask$Response.onError(AccountManager.java:1572) 11-08 15:56:23.898: W/AccMgrCallback:run(9334):     at android.accounts.IAccountManagerResponse$Stub.onTransact(IAccountManagerResponse.java:69) 11-08 15:56:23.898: W/AccMgrCallback:run(9334):     at android.os.Binder.execTransact(Binder.java:388) 11-08 15:56:23.898: W/AccMgrCallback:run(9334):     at dalvik.system.NativeStart.run(Native Method)   Do anyone have any idea about this isse? It is such a basic app, I was not expecting anything unusual. Did I do anything wrong in my app?
6108
Why do I get compiler errors with this Java code?  1  public List&lt;? extends Foo&gt; getFoos() 2  { 3    List&lt;? extends Foo&gt; foos = new ArrayList&lt;? extends Foo&gt;(); 4    foos.add(new SubFoo()); 5    return foos; 6  }  Where 'SubFoo' is a concrete class that implements Foo, and Foo is an interface.  Errors I get with this code:   On Line 3: "Cannot instantiate ArrayList&lt;? extends Foo&gt;" On Line 4: "The method add(capture#1-of ? extends Foo) in the type List&lt;capture#1-of ? extends Foo&gt; is not applicable for the arguments (SubFoo)"   Update: Thanks to Jeff C, I can change Line 3 to say "new ArrayList&lt;Foo&gt;();".  But I'm still having the issue with Line 4.
56766
To clean install Eclipse for C/C++ on Ubuntu 18.04 I tried sudo apt install eclipse eclipse-cdt. It's showing an error, see the log file....  log file..... !SESSION Fri Aug 16 14:39:20 IST 2019 ------------------------------------------ !ENTRY org.eclipse.equinox.launcher 4 0 2019-08-16 14:39:20.065 !MESSAGE Exception launching the Eclipse Platform: !STACK java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter     at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)     at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:626)     at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)     at org.eclipse.equinox.launcher.Main.run(Main.java:1438)     at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
39549
Eclipse was working as good as anything on 14.04. I did a clean install of 16.04 and installed Eclipse. But it runs a Java program only once after which it just hangs during subsequent attempts before I remove and reinstall it. I have tried many things, since in the beginning I needed CDT as well. Right now, I just want to remove everything related to eclipse and do a fresh install (remove all the configs and dependencies). Please note that I used Eclipse installer to install Eclipse and the eclipse icon image is also not appearing (the default ubuntu ? is appearing).
78730
When writing a controller for a Lightning Component, it is convenient to add the data transfer object classes as inner classes of the controller. This works fine for sending data to the client but I get a gack that includes a java.lang.UnsupportedOperationException when sending from client to server:     An internal server error has occurred\nError ID: 2066801247-4851   (-1600101374)\n\norg.auraframework.throwable.AuraExecutionException:   apex://LifePaymentsController:   java.lang.UnsupportedOperationException\n\tat   .(apex://LifePaymentsController)\n\tat   ui.services.facades.CoreLightningComponentFacadeImpl.runApexAction(CoreLightningComponentFacadeImpl.java:233) ...   Here is what the server-side looks like (the save1 method fails):  public class SaveRequest {     @AuraEnabled public Payee[] newPayees;     @AuraEnabled public Payment[] payments; }  ...  // Fails @AuraEnabled public static void save1(SaveRequest saveRequest) {     System.debug(JSON.serializePretty(saveRequest)); }  // Works @AuraEnabled public static void save2(String jsonString) {     SaveRequest r = (SaveRequest) JSON.deserializeStrict(jsonString, SaveRequest.class);     System.debug(JSON.serializePretty(r)); }   and the client-side:  // Fails var action = servicesComponent.get("c.save1") action.setParams({      "saveRequest": saveRequest });  // Works var action = servicesComponent.get("c.save2"); action.setParams({      "jsonString": JSON.stringify(saveRequest) });   The save2 alternative method (where deserialization is explicitly coded) works.  I interpret these results to mean that inner classes are still (April 2017) not fully supported in @AuraEnabled methods. Is that the case?
119424
I'm having trouble opening jar files because there is no java runtime in open with listed. Even I have installed it via Software Center(i also try to reinstall it via synaptic and i do a --purge via terminal).
38901
Are there any plugins/tools available to go through the classpath of an eclipse project (or workspace) and highlight any unused jars?
22922
I have the following versions of OpenJDK installed:  java-1.11.0-openjdk-amd64      1101       /usr/lib/jvm/java-1.11.0-openjdk-amd64 java-1.8.0-openjdk-amd64       1081       /usr/lib/jvm/java-1.8.0-openjdk-amd64   I get the following error using PDFsam in Lubuntu 18.04:   INFO   [12:15:47]: Starting PDFsam INFO   [12:15:48]: Transparent windows not supported by the platform INFO   [12:15:48]: Configuring Sejda 3.2.38 INFO   [12:15:48]: Gestarted in 1 second INFO   [12:15:57]: 3.pdf loaded INFO   [12:15:57]: 4.pdf loaded INFO   [12:15:57]: 5.pdf loaded INFO   [12:15:58]: Starting task (org.sejda.impl.sambox.MergeTask@81b1817) execution. WARN   [12:15:59]: New fonts found, font cache will be re-built WARN   [12:15:59]: Building on-disk font cache, this may take a while ERROR  [12:15:59]: Unexpected error java.lang.NoClassDefFoundError: Could not initialize class org.sejda.sambox.pdmodel.font.PDType1Font at org.sejda.impl.sambox.util.FontUtils.&lt;clinit&gt;(FontUtils.java:74) at org.sejda.impl.sambox.component.PDDocumentHandler.close(PDDocumentHandler.java:231) at org.sejda.common.ComponentsUtility.nullSafeClose(ComponentsUtility.java:63) at org.sejda.common.ComponentsUtility.nullSafeCloseQuietly(ComponentsUtility.java:49) at org.sejda.impl.sambox.MergeTask.closeResources(MergeTask.java:232) at org.sejda.impl.sambox.MergeTask.after(MergeTask.java:237) at org.sejda.core.service.DefaultTaskExecutionService.actualExecution(DefaultTaskExecutionService.java:151) at org.sejda.core.service.DefaultTaskExecutionService.execute(DefaultTaskExecutionService.java:71) at org.sejda.core.service.DefaultTaskExecutionService.execute(DefaultTaskExecutionService.java:58) at org.pdfsam.task.TaskExecutionController.lambda$request$0(TaskExecutionController.java:87) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
77819
Using Eclipse I want to view the source code for a core Java class (E.g. java.util.concurrent.ConcurrentHashMap) but when I navigate to the source using 'Open Declaration' it says 'Source not found' and gives me the option to attach the source.  My question is; how do i attach the source? Where do i get the source .jar from for the java.util.concurrent library?
54323
I'm using Eclipse for Java development. All my sources compile fine and the resulting application compiles fine. However, I keep getting an "red-x" error notification in the Package Explorer.  All my sources in this source directory (too long for the snapshot) compile fine, none of the show the "red-x" error icon.  Any suggestions on how to fix the problem would be highly appreciated.
82102
I have installed JDK 6, but I can't execute a Java program.   For example, I have made test.java.  I compile it with javac tes.java and there's no error when I compile it, but when I want to execute that program it always displays an error.  I execute the Java program with java tes.  Exception in thread "main" java.lang.UnsupportedClassVersionError: tes : Unsupported major.minor version 51.0     at java.lang.ClassLoader.defineClass1(Native Method)     at java.lang.ClassLoader.defineClass(ClassLoader.java:634)     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)     at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)     at java.net.URLClassLoader.access$000(URLClassLoader.java:73)     at java.net.URLClassLoader$1.run(URLClassLoader.java:212)     at java.security.AccessController.doPrivileged(Native Method)     at java.net.URLClassLoader.findClass(URLClassLoader.java:205)     at java.lang.ClassLoader.loadClass(ClassLoader.java:321)     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)     at java.lang.ClassLoader.loadClass(ClassLoader.java:266) Could not find the main class: tes. Program will exit.   My javac version is 1.7.0, my java version is 1.6.0.  Here is my tes.java code:  class tes{      public static void main(String[]args){         System.out.println("hello");         }     }