Batch build for 32 and 64 bit java SDK

Answered

I need to build 32 and 64 bit versions of my jni code interfacing native C Win32 and x64 dlls.These are for two versions of cubase plugin. 
I cannot get (figure) how this should be done in official manner. Intellij don't like me to use common code for some reason and complains that root is already used in other project even the bitness would be different. I suppose it cannot be so that this is impossible and I'm missing something. I have extremely ugly workaround using higher level directory for the other and in different windows. I would rather like to the java codes being exactly the same for both bitness versions. 

So is there official way to do this with Intellij or how you happened to have have done it?

 

0
6 comments

Please elaborate more on your project (the type, structure, build system) and what is the exact error you are getting. Thank you.

0

My build system is Intellij 2021 community. Pure java. 
Do you know what is Cubase vst plugin? Cubase c++ plugins are dlls like highpass_filter.dll. 
What do you mean by structure? That is exactly my question to you: How do I create structure that pushes out two platform versions to different output directories using the same code. Its functions are to be called by a jni dll which dll is a plugin in Cubase process.   What I need to build 32 and 64 bit versions of my jni code interfacing native C Win32 and x64 dlls. These would optimally be two different modues from exact the same code inside the one project.  So the wish is to use same java to generate code for two different runtime JVMs.
This is needed because of jni. Normally code would not care if JVM is 32 bit or 64 bit but because of native interface jni calls it suddenly has meaning.
Cubase32 is hostig 32 bit dlls. Cubase64 bit cubase plugin is hosting 64 bit dlls.
Such cubase dll interfaces my java plugin.

I got some progrees and and have two windows and separate projects and manually 
need to build both. if you don't still get what I mean I can post image of directory struture whihc reveal how it can work with two projects. But as I said I would like them to under same project as modules so that they both would get compilled in one go.

 

 

 



 

0

Or is it all about runtime environment and javac had no meaning? 
That would state that compiling produces always the same bytecode regardless of bitness of javac but jvm.dll representing JVM where the code is running must have same bitness than the dll's process which invokes the JVM and attachs the C thread into the JVM? That would make things really much simpler to set up.

0

Thanks for clarifications. 

>Intellij don't like me to use common code for some reason and complains that root is already used in other project even the bitness would be different.

IntelliJ IDEA does not support two modules having the same content root indeed. IntelliJ IDEA has support for building standard Java build projects. Do you use any custom plugin for building the native code?

If you use IDE for building Java code and want to have multiple outputs for the same source code, the workaoround would be to create two independent projects as you already did. I suppose there is also an option to use Maven to create multiple running jars for one sources: https://stackoverflow.com/q/15798936/2000323

A related request in our tracker: IDEA-134023 Multiple compiler output paths

0

Thanks for your quick and kind response. Yes I think to go with two projects. Rather than to create command line to build all. I wish there would be possibilty use same code in different modules. That is for example the whole heart of Visual Studio which I use for c++ side of system. I think in Visual Studio a project is like module in Intellij and solution is like project in Intellij. Difference being in Intellij you cannot reuse code in context of modules. It has proven extremely convinient behavior in Visual Studio( though being nightmare in many other respects).  I wonder if there is(-you being aware) some real practical reason not to allow multiple modules of a project to use same code with IntelliJ? 
Intellij is such geat piece of software so it is pity it has not such basic feature.

0

>I wonder if there is(-you being aware) some real practical reason not to allow multiple modules of a project to use same code with IntelliJ? 

Yes, unfortunately it is a limitation of the current IDE project structure. The IntelliJ IDEA heavily relies on the fact that any source file belongs to just one module. We have a related issue about this, please feel free to vote and see for more details: 

IDEABKL-6745 Cannot define two identical content roots in different module within a single project

0

Please sign in to leave a comment.