Ravi kapa

Ranch Hand
+ Follow
since Jan 05, 2012
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
11
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ravi kapa

One more update I want to use only "file" not "classpath" in @PropertySource annatation.
3 years ago
Hi All,

I want to read properties from external file using @PropertySource("file:${application_properties}"), so used annotation in configuration files as mentioned and defined


but I am getting "Could not resolve placeholder 'application_properties' in value "file:${application_properties}""

Note:Its working fine if i use @PropertySource("file:c:\filename") but i want to use placeholde and want to define that place holder in tomcat(Want to know how to do that aswell).Could you please help me to read the file properties using @PropertySource which will read the place holder defined in tomcat.

Thanks
3 years ago

Henry Wong wrote:
Are you running the bash command shell? It looks like the windows shell to me.

Henry

Henry ,You are correct that is windows shell(cmd) and I need to write the batch file(.bat) for the same requirements mentioned above.Could you please help me on this?
4 years ago

Stephan van Hulst wrote:That's not the command I posted. set is a separate command on a separate line.



sorry for that,

Here is the out put first command

E:\WS\26-05-2017\test\target>MY_VAR=$(java -cp test-0.0.1-SNAPSHOT.jar com.test.
test.App)
'MY_VAR' is not recognized as an internal or external command,
operable program or batch file.

and for set there is no variable with the name MY_VAR
4 years ago

Stephan van Hulst wrote:Is MY_VAR visible in the output when you run the following?



No,

4 years ago

Stephan van Hulst wrote:You shouldn't post an image. Copy the output from your terminal.



4 years ago

Stephan van Hulst wrote:Again, show us the output of just calling your java command.



Sorry,I could not able to paste the image here
4 years ago

Stephan van Hulst wrote:Your application doesn't print anything to standard output. You're using the error stream.

Same result for output stream aswell
4 years ago

Henry Wong wrote:
Both the usage of backquotes, and the usage of $() should work.  If it doesn't, or seems to not work, you need to provide more details.  This is a debugging situation... and we can't help you debug with no visibility.

Henry



Here is the java code



Here is the .bat file


4 years ago

Stephan van Hulst wrote:Don't do this from Java. Use your shell's capabilities. In Bash, you can try this:

Thanks for the reply Stephan,But its not working in my scenario.
4 years ago

Henry Wong wrote:
Bash (actually, *all* of the shells) allows you to set a script variable to the output of a program -- via usage of the single back quote.

So, you program can simply print the result to standard output. And exit, of course, as Bash needs to get control back to finish the assignment...

Henry

Thanks for the reply Henry,Could please give me the example.
4 years ago
Hi All,

Is there anyway I can get the result of java program out put to bash script variable ? Suppose I have jar with main() and print just string,what I want to do is I want to take that string to shell script variable.
4 years ago
Recently I got the framework called BeanIO which is very good for fixed length file I/O,But only the issue is with printing string with particular length other than English(like Japanese,thai)

Eg: suppose I want to print "こんにちは" this at particular position , its printing perfect(UTF-8 encoding) but the length of this string is mis calculating. Because That the position of the other values are not printing properly.

suppose I want to print "こんにちは" at 5 and next value at 6 and I used length 2 for printing(which means only print 2 character and ignore remaining).This printing Japanese language
disturbing entire row values lengths of the text file.

Can any one help me how to calculate length of this japanese/thai string like english?  Solution for this saves my time
4 years ago