When I run a main class in IDEA, it puts the module and its dependencies on a module path. Is it possible to change it to a classpath?
How to run Java 9 application with classpath rather than module path in IDEA?
5.8k Views Asked by ZhekaKozlov At
2
There are 2 best solutions below
0
Marcus
On
To answer the question, the heuristic IDEA uses to run an application with a module path is currently slightly off (IDEA 2018.01). It apparently takes more into consideration than it should.
See IDEA-187390 and IDEA-193714 for details.
So if your current project does not have a module-info file and you still end up with a module path the current case that I know is that you are running the main class from a dependency. Just build a small wrapper inside your project and run the main class from there, that brings you back to the classpath.
Related Questions in JAVA
- Add image to JCheckBoxMenuItem
- How to access invisible Unordered List element with Selenium WebDriver using Java
- Inheritance in Java, apparent type vs actual type
- Java catch the ball Game
- Access objects variable & method by name
- GridBagLayout is displaying JTextField and JTextArea as short, vertical lines
- Perform a task each interval
- Compound classes stored in an array are not accessible in selenium java
- How to avoid concurrent access to a resource?
- Why does processing goes slower on implementing try catch block in java?
- Redirect inside java interceptor
- Push toolbar content below statusbar
- Animation in Java on top of JPanel
- JPA - How to query with a LIKE operator in combination with an AttributeConverter
- Java Assign a Value to an array cell
Related Questions in INTELLIJ-IDEA
- How to Enable MultiDex Support in Intellij IDEA
- Where has "Show Type Info on Mouse Motion" gone in Intellij 14
- Simple JavaEE HTML GET/POST application
- Behaviour Difference: Intellij vs Eclipse
- IntelliJ warns "Cannot resolve variable" on EL variables declared in parent page of include
- Perforce workspaces and multiple branches
- How to invoke method/constructor parameter hint in IntelliJ?
- Breakpoint "concurrency" in Intellij
- How do I install Intellij on Ubuntu 15.04?
- How to disable Code Completion in Android Studio?
- How to unchain my program?
- How can I debug scala.js unit tests?
- Weblogic 12c web application not start properly after server reboot
- What is the principle of IntelliJ IDEA's remote debug?
- Node.js setup on Intellij Idea
Related Questions in JAVA-9
- Use-cases for reactive streams using java 9 Flows in Servlets?
- JShell possible lossy conversion from double to float
- Netbeans 8.2 with jdk 9
- Cannot start Eclipse Neon with JDK 9 on Ubuntu - Exit code=13
- How to solve InaccessibleObjectException ("Unable to make {member} accessible: module {A} does not 'opens {package}' to {B}") on Java 9?
- Is jol a little broken under Java9?
- Why does compilation of public APIs leaking internal types not fail?
- Where should I put unit tests when migrating a Java 8 project to Jigsaw
- Unclear intrinsic behaviour in Java9
- weakCompareAndSwap vs compareAndSwap
- How can I handle split packages in automatic modules?
- IntelliJ doesn't Understand java libraries on Java9-ea
- Jigsaw test dependencies in classpath: why is the superclass in another JAR not accessible?
- How do i get all the classes of sun.font in jdk9
- Will Eclipse 3.8 (or Juno) be able to run on Java 9?
Related Questions in JAVA-PLATFORM-MODULE-SYSTEM
- How to solve InaccessibleObjectException ("Unable to make {member} accessible: module {A} does not 'opens {package}' to {B}") on Java 9?
- Why does compilation of public APIs leaking internal types not fail?
- Where should I put unit tests when migrating a Java 8 project to Jigsaw
- How can I handle split packages in automatic modules?
- IntelliJ doesn't Understand java libraries on Java9-ea
- Jigsaw test dependencies in classpath: why is the superclass in another JAR not accessible?
- How is Java 8 modules different from OSGi?
- Where to place module-info.java using Java 9?
- How to express dependency in maven on java ee features for transition to Java 9?
- Is it possible to mix --class-path and --module-path in javac (JDK 9)?
- How many unnamed modules are created in Java 9?
- Mockito in maven using JPMS cannot access a member of class with modifiers "private"
- Spring NoSuchBeanDefinitionException when switching to JPMS (Java Platform Module System)
- Create a personalised JRE with Java 15 on Windows for Linux and Mac
- org.json cannot be resolved to a module?
Related Questions in MODULE-PATH
- fatal error compiling invalid flag --module-path
- Is it possible to mix --class-path and --module-path in javac (JDK 9)?
- Module path problem when looking for a remote EJB in JNDI
- Modulepath and Classpath can't be found in Java Build Path Libraries
- How can I force Gradle to use --module-path instead of -cp?
- Automatically determine what to place on Classpath and Modulepath?
- Removing Class Path and Module Path from an Eclipse Project
- Not able to compile and run a classpath Java Application
- What is the value of adding non-modular jars to the -classpath and modular jars to the --module-path when compiling a module?
- In python, Is it possible to get the path of the invoked from the invoked file?
- Which system modules are on the module path by default?
- In Eclipse, what is the difference between modulepath and classpath?
- Java 9 automatic modules not found
- Inspect --module-path value at runtime
- Loading classes and resources post Java 9
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
If you don't define a module-info, IDEA would set the application and your dependencies on the classpath. Since you have a module-info it's an explicit module so it has to be on the module path. Normally you would handle your dependecies now as automatic-modules.
Howsoever, your dependencies at least have a good reason to be on the classpath. We discussed that here Why Java 9 does not simply turn all JARs on the class path into automatic modules?
For example, mymodule depends on an automatic-module which however needs a jar that can't become an automatic-module yet. On commandline it would like this:
java -cp legacy.jar -p "mymodule.jar;automodule.jar;" -m mymodule/com.example.mymodule.Application
IMO intellij doesn't currently support that. As a workaround to run the entire application on the classpath at least, you could rename the model-info for disabling/not to be a jigsaw-module for a moment.