Compiling a Mex file for Java










0















I found a java based TCP-IP system for matlab which might fix many problems I've been having with multiple and uninterruptible connections. However I'm stumped on how to get it working. I have compiled code under linux plenty of times but never on windows.



The code I'm trying to compile is located here and it states:



Build



Compile MEX files and Java helpers by the attached Makefile.



make


The question is how? I thought of using Visual studio command prompt but I end up getting an error:




makefile(8) : fatal error U1036: syntax error : too many names to left of '='




Which suggests either I have to edit the makefile or I'm using the wrong compiler. And I have no knowledge of Java so I don't even know where to begin when compiling it.



edit: Updating to show what code is in the makefile



MATLABDIR ?= /usr/local/matlab
MATLAB := $(MATLABDIR)/bin/matlab
MEX := $(MATLABDIR)/bin/mex
MEXEXT := $(shell $(MATLABDIR)/bin/mexext)
MEXSOURCES := $(wildcard private/*.cc)
MEXTARGETS := $(patsubst %.cc,%.$(MEXEXT),$(MEXSOURCES))
CLASSPATH := java
JAVASOURCES := $(wildcard java/matlab_tcpip/*.java)
JAVATARGETS = $(patsubst %.java,%.class,$(JAVASOURCES))
JARFILE = java/matlab_tcpip.jar

all: $(JARFILE) $(MEXTARGETS)

%.$(MEXEXT):%.cc
$(MEX) $< -output $@

$(JARFILE): $(JAVATARGETS)
jar cvf $@ -C java matlab_tcpip/
jar i $@

%.class:%.java
javac -cp $(CLASSPATH) $<

test: $(JARFILE)
echo "run test/runServer.m" | $(MATLAB) -nodisplay &
echo "run test/runClient.m" | $(MATLAB) -nodisplay

clean:
rm $(MEXTARGETS) java/matlab_tcpip/*.class $(JARFILE)









share|improve this question
























  • The easiest way to compile stuff on Windows is to use Cygwin. It is a (more-or-less) Posix environment on top of Windows, and you can build most Unix projects without any modifications. You'll still have to adjust the Makefile to point to the right MATLAB directory, of course.

    – Cris Luengo
    Nov 15 '18 at 7:17











  • I don't know if that will work as it seems I need to compile it in java

    – Hojo.Timberwolf
    Nov 15 '18 at 8:02






  • 1





    I don’t see why not. From Cygwin you can also run any Windows tools. There is no reason you wouldn’t be able to compile Java. — Ah! Here you go: stackoverflow.com/questions/28259282/…

    – Cris Luengo
    Nov 15 '18 at 14:21















0















I found a java based TCP-IP system for matlab which might fix many problems I've been having with multiple and uninterruptible connections. However I'm stumped on how to get it working. I have compiled code under linux plenty of times but never on windows.



The code I'm trying to compile is located here and it states:



Build



Compile MEX files and Java helpers by the attached Makefile.



make


The question is how? I thought of using Visual studio command prompt but I end up getting an error:




makefile(8) : fatal error U1036: syntax error : too many names to left of '='




Which suggests either I have to edit the makefile or I'm using the wrong compiler. And I have no knowledge of Java so I don't even know where to begin when compiling it.



edit: Updating to show what code is in the makefile



MATLABDIR ?= /usr/local/matlab
MATLAB := $(MATLABDIR)/bin/matlab
MEX := $(MATLABDIR)/bin/mex
MEXEXT := $(shell $(MATLABDIR)/bin/mexext)
MEXSOURCES := $(wildcard private/*.cc)
MEXTARGETS := $(patsubst %.cc,%.$(MEXEXT),$(MEXSOURCES))
CLASSPATH := java
JAVASOURCES := $(wildcard java/matlab_tcpip/*.java)
JAVATARGETS = $(patsubst %.java,%.class,$(JAVASOURCES))
JARFILE = java/matlab_tcpip.jar

all: $(JARFILE) $(MEXTARGETS)

%.$(MEXEXT):%.cc
$(MEX) $< -output $@

$(JARFILE): $(JAVATARGETS)
jar cvf $@ -C java matlab_tcpip/
jar i $@

%.class:%.java
javac -cp $(CLASSPATH) $<

test: $(JARFILE)
echo "run test/runServer.m" | $(MATLAB) -nodisplay &
echo "run test/runClient.m" | $(MATLAB) -nodisplay

clean:
rm $(MEXTARGETS) java/matlab_tcpip/*.class $(JARFILE)









share|improve this question
























  • The easiest way to compile stuff on Windows is to use Cygwin. It is a (more-or-less) Posix environment on top of Windows, and you can build most Unix projects without any modifications. You'll still have to adjust the Makefile to point to the right MATLAB directory, of course.

    – Cris Luengo
    Nov 15 '18 at 7:17











  • I don't know if that will work as it seems I need to compile it in java

    – Hojo.Timberwolf
    Nov 15 '18 at 8:02






  • 1





    I don’t see why not. From Cygwin you can also run any Windows tools. There is no reason you wouldn’t be able to compile Java. — Ah! Here you go: stackoverflow.com/questions/28259282/…

    – Cris Luengo
    Nov 15 '18 at 14:21













0












0








0








I found a java based TCP-IP system for matlab which might fix many problems I've been having with multiple and uninterruptible connections. However I'm stumped on how to get it working. I have compiled code under linux plenty of times but never on windows.



The code I'm trying to compile is located here and it states:



Build



Compile MEX files and Java helpers by the attached Makefile.



make


The question is how? I thought of using Visual studio command prompt but I end up getting an error:




makefile(8) : fatal error U1036: syntax error : too many names to left of '='




Which suggests either I have to edit the makefile or I'm using the wrong compiler. And I have no knowledge of Java so I don't even know where to begin when compiling it.



edit: Updating to show what code is in the makefile



MATLABDIR ?= /usr/local/matlab
MATLAB := $(MATLABDIR)/bin/matlab
MEX := $(MATLABDIR)/bin/mex
MEXEXT := $(shell $(MATLABDIR)/bin/mexext)
MEXSOURCES := $(wildcard private/*.cc)
MEXTARGETS := $(patsubst %.cc,%.$(MEXEXT),$(MEXSOURCES))
CLASSPATH := java
JAVASOURCES := $(wildcard java/matlab_tcpip/*.java)
JAVATARGETS = $(patsubst %.java,%.class,$(JAVASOURCES))
JARFILE = java/matlab_tcpip.jar

all: $(JARFILE) $(MEXTARGETS)

%.$(MEXEXT):%.cc
$(MEX) $< -output $@

$(JARFILE): $(JAVATARGETS)
jar cvf $@ -C java matlab_tcpip/
jar i $@

%.class:%.java
javac -cp $(CLASSPATH) $<

test: $(JARFILE)
echo "run test/runServer.m" | $(MATLAB) -nodisplay &
echo "run test/runClient.m" | $(MATLAB) -nodisplay

clean:
rm $(MEXTARGETS) java/matlab_tcpip/*.class $(JARFILE)









share|improve this question
















I found a java based TCP-IP system for matlab which might fix many problems I've been having with multiple and uninterruptible connections. However I'm stumped on how to get it working. I have compiled code under linux plenty of times but never on windows.



The code I'm trying to compile is located here and it states:



Build



Compile MEX files and Java helpers by the attached Makefile.



make


The question is how? I thought of using Visual studio command prompt but I end up getting an error:




makefile(8) : fatal error U1036: syntax error : too many names to left of '='




Which suggests either I have to edit the makefile or I'm using the wrong compiler. And I have no knowledge of Java so I don't even know where to begin when compiling it.



edit: Updating to show what code is in the makefile



MATLABDIR ?= /usr/local/matlab
MATLAB := $(MATLABDIR)/bin/matlab
MEX := $(MATLABDIR)/bin/mex
MEXEXT := $(shell $(MATLABDIR)/bin/mexext)
MEXSOURCES := $(wildcard private/*.cc)
MEXTARGETS := $(patsubst %.cc,%.$(MEXEXT),$(MEXSOURCES))
CLASSPATH := java
JAVASOURCES := $(wildcard java/matlab_tcpip/*.java)
JAVATARGETS = $(patsubst %.java,%.class,$(JAVASOURCES))
JARFILE = java/matlab_tcpip.jar

all: $(JARFILE) $(MEXTARGETS)

%.$(MEXEXT):%.cc
$(MEX) $< -output $@

$(JARFILE): $(JAVATARGETS)
jar cvf $@ -C java matlab_tcpip/
jar i $@

%.class:%.java
javac -cp $(CLASSPATH) $<

test: $(JARFILE)
echo "run test/runServer.m" | $(MATLAB) -nodisplay &
echo "run test/runClient.m" | $(MATLAB) -nodisplay

clean:
rm $(MEXTARGETS) java/matlab_tcpip/*.class $(JARFILE)






java matlab mex






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 8:01







Hojo.Timberwolf

















asked Nov 15 '18 at 6:00









Hojo.TimberwolfHojo.Timberwolf

398214




398214












  • The easiest way to compile stuff on Windows is to use Cygwin. It is a (more-or-less) Posix environment on top of Windows, and you can build most Unix projects without any modifications. You'll still have to adjust the Makefile to point to the right MATLAB directory, of course.

    – Cris Luengo
    Nov 15 '18 at 7:17











  • I don't know if that will work as it seems I need to compile it in java

    – Hojo.Timberwolf
    Nov 15 '18 at 8:02






  • 1





    I don’t see why not. From Cygwin you can also run any Windows tools. There is no reason you wouldn’t be able to compile Java. — Ah! Here you go: stackoverflow.com/questions/28259282/…

    – Cris Luengo
    Nov 15 '18 at 14:21

















  • The easiest way to compile stuff on Windows is to use Cygwin. It is a (more-or-less) Posix environment on top of Windows, and you can build most Unix projects without any modifications. You'll still have to adjust the Makefile to point to the right MATLAB directory, of course.

    – Cris Luengo
    Nov 15 '18 at 7:17











  • I don't know if that will work as it seems I need to compile it in java

    – Hojo.Timberwolf
    Nov 15 '18 at 8:02






  • 1





    I don’t see why not. From Cygwin you can also run any Windows tools. There is no reason you wouldn’t be able to compile Java. — Ah! Here you go: stackoverflow.com/questions/28259282/…

    – Cris Luengo
    Nov 15 '18 at 14:21
















The easiest way to compile stuff on Windows is to use Cygwin. It is a (more-or-less) Posix environment on top of Windows, and you can build most Unix projects without any modifications. You'll still have to adjust the Makefile to point to the right MATLAB directory, of course.

– Cris Luengo
Nov 15 '18 at 7:17





The easiest way to compile stuff on Windows is to use Cygwin. It is a (more-or-less) Posix environment on top of Windows, and you can build most Unix projects without any modifications. You'll still have to adjust the Makefile to point to the right MATLAB directory, of course.

– Cris Luengo
Nov 15 '18 at 7:17













I don't know if that will work as it seems I need to compile it in java

– Hojo.Timberwolf
Nov 15 '18 at 8:02





I don't know if that will work as it seems I need to compile it in java

– Hojo.Timberwolf
Nov 15 '18 at 8:02




1




1





I don’t see why not. From Cygwin you can also run any Windows tools. There is no reason you wouldn’t be able to compile Java. — Ah! Here you go: stackoverflow.com/questions/28259282/…

– Cris Luengo
Nov 15 '18 at 14:21





I don’t see why not. From Cygwin you can also run any Windows tools. There is no reason you wouldn’t be able to compile Java. — Ah! Here you go: stackoverflow.com/questions/28259282/…

– Cris Luengo
Nov 15 '18 at 14:21












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53313314%2fcompiling-a-mex-file-for-java%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53313314%2fcompiling-a-mex-file-for-java%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

What does pagestruct do in Eviews?

Dutch intervention in Lombok and Karangasem

Channel Islands