how to specify a query like "java with (developer OR programmer)" using solr dismax handler.. It works with solr standard handler but not with dismax
You have to understand that dismax is not designed to handle such queries. Dismax supports a simplified version of the Lucene QueryParser syntax. When using it, it allows the users only to provide keywords and not to bother with syntax.
You can find more details about dismax here. Pay attention to the part about the mm parameter that allows to simulate boolean queries with dismax.
The default for dismax is OR (optional), and if you want terms to be mandatory you must add a plus-sign in front of them. So assuming your query must contain "java with" something like "+java +with developer programmer" should work.
The mm is used to set the number of optional clauses that must match. Default is 100%, so this will probably need some tweaking to give the result you want. There are some examples to be found here