Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Problem running COMSOL 4.0a with MATLAB

Please login with a confirmed email address before reporting spam

Hi all,

having studied the manual, I can't get the LiveLink for MATLAB functioning. I use Windows and MATLAB R2010a. At my university the preferred way is to first start a COMSOL server and then start MATLAB and run the mphstart function. The mli-path is added to the MATLAB directory. COMSOL is listening to port 2036, but when running mphstart gives the following error

??? Java exception occurred:
java.lang.RuntimeException: Not possible to determine the installation path 'cs.root'.

at com.comsol.systemutils.SystemUtil.b(Unknown Source)

at com.comsol.systemutils.SystemUtil.getCsRoot(Unknown Source)

at com.comsol.systemutils.SystemUtil.getPluginsRoot(Unknown Source)

at com.comsol.util.methods.PluginUtil.a(Unknown Source)

at com.comsol.model.util.ModelUtil.getModelManager(Unknown Source)

at com.comsol.model.util.ModelUtil.connect(Unknown Source)


Error in ==> c:\Program Files\COMSOL40a\mli\mphstart.p>mphstart at 68

It seems like there are some incorrect folders somewhere. I've checked the ini-files and they seem ok. Anyone have any suggestion what to do?

6 Replies Last Post 9 déc. 2016, 04:44 UTC−5

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 4 oct. 2010, 11:40 UTC−4
yeps
1 If you are not admin, talk to your admin about that

2 if you are admin or your admin cannot solve the issue, open a ticket with support comsol they are good at solving these issues usually

JF
yeps 1 If you are not admin, talk to your admin about that 2 if you are admin or your admin cannot solve the issue, open a ticket with support comsol they are good at solving these issues usually JF

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 27 nov. 2010, 20:24 UTC−5
Jones,
Thank you for your help.

For others that are running into the same problem:
It turns out that for the mphstart function to work, Comsol must be installed directly to the C drive. This is the default, but if you change the installation directory from C:\Comsol40a to C:\Program Files\Comsol40a you will run into this cs.root issue. Just uninstall and reinstall to C:\Comsol40a.
Jones, Thank you for your help. For others that are running into the same problem: It turns out that for the mphstart function to work, Comsol must be installed directly to the C drive. This is the default, but if you change the installation directory from C:\Comsol40a to C:\Program Files\Comsol40a you will run into this cs.root issue. Just uninstall and reinstall to C:\Comsol40a.

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 28 nov. 2010, 02:46 UTC−5
Hi

the best, is to get hands on the 4.1 and install the new patch they gave out a few days ago, see the main web site

--
Good luck
Ivar
Hi the best, is to get hands on the 4.1 and install the new patch they gave out a few days ago, see the main web site -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 9 janv. 2014, 09:31 UTC−5
Hi everyone,
I was having the same problem with the following output on COMSOL4.3b and COMSOL4.4

c:\Program Files\COMSOL\COMSOL43b\demo>java -jar start.jar

Exception in thread "main" java.lang.ExceptionInInitializerError
at com.comsol.model.util.ModelUtil.connect(Unknown Source)
at StartPoint.main(StartPoint.java:13)
Caused by: java.lang.RuntimeException: Not possible to determine the installation path 'cs.root'.
at com.comsol.systemutils.SystemUtil.c(Unknown Source)
at com.comsol.systemutils.SystemUtil.getCsRoot(Unknown Source)
at com.comsol.systemutils.SystemUtil.<clinit>(Unknown Source)
... 2 more

Installing COMSOL to C:\COMSOL solved the problem!
Hi everyone, I was having the same problem with the following output on COMSOL4.3b and COMSOL4.4 c:\Program Files\COMSOL\COMSOL43b\demo>java -jar start.jar Exception in thread "main" java.lang.ExceptionInInitializerError at com.comsol.model.util.ModelUtil.connect(Unknown Source) at StartPoint.main(StartPoint.java:13) Caused by: java.lang.RuntimeException: Not possible to determine the installation path 'cs.root'. at com.comsol.systemutils.SystemUtil.c(Unknown Source) at com.comsol.systemutils.SystemUtil.getCsRoot(Unknown Source) at com.comsol.systemutils.SystemUtil.(Unknown Source) ... 2 more Installing COMSOL to C:\COMSOL solved the problem!

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 28 mai 2014, 12:36 UTC−4
Update:
Modify your code and use:

import com.comsol.systemutils.SystemUtil;

System.out.println(SystemUtil.getCsRoot());
System.setProperty("cs.root", "C:\\COMSOL\\COMSOL43b");
System.out.println(SystemUtil.getCsRoot());
Update: Modify your code and use: import com.comsol.systemutils.SystemUtil; System.out.println(SystemUtil.getCsRoot()); System.setProperty("cs.root", "C:\\COMSOL\\COMSOL43b"); System.out.println(SystemUtil.getCsRoot());

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 9 déc. 2016, 04:44 UTC−5
although this is a pretty old issue, it still exists.

I am using COMSOL 5.2a and stumbled into the issue when building a release version of my java program that uses the COMSOL java interface for fem modeling. In Eclipse everything works fine, but when I packed jar files and wanted to start them including the COMSOL libraries in the classpath I got the same error message.

Thanks to Matthias for his hint to use the system properties to define cs.root.

I have observed that both SystemUtil.getSysProps() and SystemUtil.getCsRoot() throw the exception and unfortunately I was not able to catch the exception, so one have to set cs.root before.

Following workaround worked well for me, I hope it will be stable against version updates. I search the java path for a directory that contains 'Multiphysics' and use that as cs.root:

Properties props = System.getProperties();
String path = props.getProperty("java.class.path");
int pos=path.indexOf("Multiphysics");
int sem1=path.substring(0, pos).lastIndexOf(";");
System.setProperty("cs.root", path.substring(sem1+1,pos+12));
System.out.println("cs.root set to "+SystemUtil.getCsRoot());


But let's be aware that this is only a workaround. I guess that there is some bug in the code that causes the problem to identify the path. My guess: It is either the backslash\ or slash/ in the path or filenames containing spaces (I have windows, so Comsol in installed under 'program files')
although this is a pretty old issue, it still exists. I am using COMSOL 5.2a and stumbled into the issue when building a release version of my java program that uses the COMSOL java interface for fem modeling. In Eclipse everything works fine, but when I packed jar files and wanted to start them including the COMSOL libraries in the classpath I got the same error message. Thanks to Matthias for his hint to use the system properties to define cs.root. I have observed that both SystemUtil.getSysProps() and SystemUtil.getCsRoot() throw the exception and unfortunately I was not able to catch the exception, so one have to set cs.root before. Following workaround worked well for me, I hope it will be stable against version updates. I search the java path for a directory that contains 'Multiphysics' and use that as cs.root: Properties props = System.getProperties(); String path = props.getProperty("java.class.path"); int pos=path.indexOf("Multiphysics"); int sem1=path.substring(0, pos).lastIndexOf(";"); System.setProperty("cs.root", path.substring(sem1+1,pos+12)); System.out.println("cs.root set to "+SystemUtil.getCsRoot()); But let's be aware that this is only a workaround. I guess that there is some bug in the code that causes the problem to identify the path. My guess: It is either the backslash\ or slash/ in the path or filenames containing spaces (I have windows, so Comsol in installed under 'program files')

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.